Skip to content

HolzShots/HolzShots.Input.Keyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Global Hotkey library used in HolzShots

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •  

Languages