API Docs

A modal hotkey group returned by hs.hotkey.createModal(). Hotkeys bound to the modal via bind() are only enabled while the modal is active (i.e. between enter() and exit()).

Properties

isActive

boolean
Whether the modal is currently active

enterFn

Function|null
Callback invoked when the modal is entered

exitFn

Function|null
Callback invoked when the modal is exited

Methods

bind(mods, key, callbackPressed, callbackReleased) -> HSHotkeyModal

Bind a hotkey to this modal. The hotkey is only enabled while the modal is active.
bind(mods, key, callbackPressed, callbackReleased) -> HSHotkeyModal
Name Type Description
mods string[] - Modifier keys for the hotkey (e.g. ["cmd", "shift"])
key string - Key name for the hotkey (e.g. "h")
callbackPressed Function|null - Called when the hotkey is pressed, or null
callbackReleased Function|null - Called when the hotkey is released, or null
HSHotkeyModal
This modal, for chaining

enter() -> HSHotkeyModal

Enter the modal: its trigger (if any) is disabled and its bound hotkeys are enabled.
enter() -> HSHotkeyModal
HSHotkeyModal
This modal, for chaining

exit() -> HSHotkeyModal

Exit the modal: its bound hotkeys are disabled and its trigger (if any) is re-enabled.
exit() -> HSHotkeyModal
HSHotkeyModal
This modal, for chaining

destroy() -> None

Destroy the modal, along with its trigger and all hotkeys bound to it.
destroy() -> None
None