API Docs

Object representing a system-wide hotkey. You should not create these objects directly, but rather, use the methods in hs.hotkey to instantiate these.

Properties

callbackPressed

function | null
The callback function to be called when the hotkey is pressed, or null to remove it

callbackReleased

function | null
The callback function to be called when the hotkey is released, or null to remove it

Methods

enable() -> boolean

Enable the hotkey
enable() -> boolean
boolean
True if the hotkey was enabled, otherwise False
const hk = hs.hotkey.bind(["cmd"], "h", () => {})
hk.enable()

disable() -> None

Disable the hotkey
disable() -> None
None
const hk = hs.hotkey.bind(["cmd"], "h", () => {})
hk.disable()

isEnabled() -> boolean

Check if the hotkey is currently enabled
isEnabled() -> boolean
boolean
True if the hotkey is enabled, otherwise False
const hk = hs.hotkey.bind(["cmd"], "h", () => {})
console.log(hk.isEnabled())

destroy() -> None

Disable and permanently remove this hotkey, releasing all associated resources
destroy() -> None
None
const hk = hs.hotkey.bind(["cmd"], "h", () => {})
hk.destroy()