Skip to content

msioen/JFHotkeyManager.Binding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NuGet Status

HotkeyManager.Binding

Xamarin binding for the JFHotkeyManager

JFHotkeyManager is a small Cocoa convenience wrapper around Carbon's mechanism for implementing global hotkeys. It allows you to add hotkeys to your app with a couple of lines of code.

Usage

Hotkeys can be bound either by individually specifying keycode/modifiers, or symbolically using a string. The latter is more convenient but probably less reliable across international keyboards.

// Initialise a new hotkey manager
var hotkeyManager = new JFHotkeyManager();
            
// Bind a hotkey by key code reference number and modifiers:
hotkeyManager.BindKeyRef(49, (uint)(EModifierKeys.CmdKey | EModifierKeys.ShiftKey), this, new ObjCRuntime.Selector("onHotkeyExecuted"));
            
// Bind a hotkey symbolically
hotkeyManager.Bind("command shift up", this, new ObjCRuntime.Selector("onHotkeyExecuted"));

[Export("onHotkeyExecuted")]
void OnHotkeyExecuted()
{
  // do something
}

About

Binding for JFHotkeyManager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published