HolzShots.Input.Keyboard 2.0.1

dotnet add package HolzShots.Input.Keyboard --version 2.0.1                
NuGet\Install-Package HolzShots.Input.Keyboard -Version 2.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HolzShots.Input.Keyboard" Version="2.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HolzShots.Input.Keyboard --version 2.0.1                
#r "nuget: HolzShots.Input.Keyboard, 2.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HolzShots.Input.Keyboard as a Cake Addin
#addin nuget:?package=HolzShots.Input.Keyboard&version=2.0.1

// Install HolzShots.Input.Keyboard as a Cake Tool
#tool nuget:?package=HolzShots.Input.Keyboard&version=2.0.1                

HolzShots.Input.Keyboard

Global Hotkey library used in HolzShots.

Usage of Hotkey primitives:

var hook = KeyboardHookSelector.CreateHookForCurrentPlatform(someForm);
// someForm can be anything that implements ISynchronizeInvoke

var hk = new Hotkey(Input.Keyboard.ModifierKeys.Shift, Keys.F8);
hk.KeyPressed += (hook, h) => Console.WriteLine($"Hotkey pressed: {h}");

hook.RegisterHotkey(hk);

var hk2 = Hotkey.Parse("Shift+F9");
hk2.KeyPressed += (hook, h) => Console.WriteLine($"Hotkey pressed: {h}");

hook.RegisterHotkey(hk2);

// Clean up:
hook.UnregisterHotkey(hk2);

hook.UnregisterAllHotkeys();

The Hotkey class can be serialized to Windows Forms Settings as well as re-instantiated using Hotkey.Parse(hk.ToString()). You may also implement a JSON converter to parse hotkey strings from JSON config files.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 136 10/31/2024
2.0.0-preview.4 983 6/14/2023
2.0.0-preview.3 211 1/30/2023