Registers a global hotkey that triggers even when the PowerKeys window is not focused.
Combo format: modifier tokens joined with +, with the main key last.
Either-side modifiers: Ctrl, Shift, Alt, Win — match either physical side.
Lateral modifiers: LCtrl, RCtrl, LShift, RShift, LAlt, RAlt, LWin, RWin — match only the named side.
The main key can be a named key, a single character, or a hex code prefixed with VK_.
Press-order independence: The combo fires when the last required key goes down, regardless of which order the keys were physically pressed.
Modifier as main key: The last token can itself be a modifier (e.g. "Ctrl+Alt" where Alt is the main key). The combo fires when both are held, in any press order.
Modifier leak cleanup (default block: true): Because modifier keys reach the foreground application individually as they are pressed, any modifier that was already down before the combo was fully recognized has already been delivered to the app. When the combo fires, synthetic key-up events are automatically injected for those leaked modifiers so the foreground application sees a clean state. Subsequent physical key-up events for those modifiers are suppressed so the application does not receive an unmatched release.
Key combination string, e.g. "Ctrl+Shift+T", "Ctrl+Alt", "F1".
Function invoked each time the hotkey fires.
Optionaloptions: HotkeyOptionsOptional configuration object. See HotkeyOptions for details.
Registers a hotkey that fires exactly once per physical key press, suppressing auto-repeat events. The callback fires only on the initial key-down; holding the key does not repeat it. The held state is cleared when the combo keys are released, allowing the next press to fire again.
Press-order independence: The combo fires when the last required key goes down, regardless of which order the keys were physically pressed.
Modifier as main key: The last token can itself be a modifier (e.g. "Ctrl+Alt"). The combo fires when both are held, in any press order.
Modifier leak cleanup (default block: true): Any modifier keys that reached the foreground application before the combo was fully recognized receive automatic synthetic key-up events when the combo fires. Subsequent physical key-ups for those modifiers are suppressed, leaving the application in a clean modifier state.
Key combination string, e.g. "Ctrl+Shift+T", "Ctrl+Alt", "F1".
Function invoked once on the initial key-down.
Optionaloptions: HotkeyOptionsOptional configuration object. See HotkeyOptions for details.
Registers a callback that fires when a key combination is released.
Useful for held-key behaviors or measuring hold duration.
Designed to be paired with OnDown on the same combo to bracket a hold.
Modifier combos: Works with modifier-as-main-key combos (e.g. "Ctrl+Alt"). The callback fires on the physical key-up even though those keys are suppressed from reaching other applications by a paired OnDown registration.
Note: OnUp does not itself register a block. Blocking is controlled entirely by the matching OnDown or Register call. When a key-down was blocked, the key-up is automatically suppressed even after modifiers are released — no extra configuration is needed here.
Key combination string, e.g. "Ctrl+Shift+T", "Ctrl+Alt", "F1".
Function invoked when the combo keys are released.
Optionaloptions: HotkeyUpOptionsOnly deviceId is accepted. Passing block or wildcard is a type error.