Skip to content
Binding for JFHotkeyManager
Objective-C C# Smalltalk
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
binding
nuget
xCode
.gitignore
LICENSE
README.md

README.md

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
}
You can’t perform that action at this time.