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

JSValue
The callback function to be called when the hotkey is pressed

callbackReleased

JSValue
The callback function to be called when the hotkey is released

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())

delete() -> None

Delete the hotkey (disables and clears callbacks)
delete() -> None
None
const hk = hs.hotkey.bind(["cmd"], "h", () => {})
hk.delete()