hs.hotkey
Module
Module for creating and managing system-wide hotkeys
Types
This module provides the following types:
Properties
This module has no properties.
Methods
hs.hotkey.bind
Bind a hotkey
Hammerspoon 2/Modules/hs.hotkey/HSHotkeyModule.swift:23
Declaration
hs.hotkey.bind(mods, key, callbackPressed, callbackReleased) -> HSHotkey
Parameters
-
modsJSValueAn array of modifier key strings (e.g., ["cmd", "shift"])
-
keystringThe key name or character (e.g., "a", "space", "return")
-
callbackPressedJSValueA JavaScript function to call when the hotkey is pressed
-
callbackReleasedJSValueA JavaScript function to call when the hotkey is released
Return Value
A hotkey object, or nil if binding failed
hs.hotkey.bindSpec
Bind a hotkey with a message description
Hammerspoon 2/Modules/hs.hotkey/HSHotkeyModule.swift:34
Declaration
hs.hotkey.bindSpec(mods, key, message, callbackPressed, callbackReleased) -> HSHotkey
Parameters
-
modsJSValueAn array of modifier key strings
-
keystringThe key name or character
-
messagestringA description of what this hotkey does (currently unused, for future features)
-
callbackPressedJSValueA JavaScript function to call when the hotkey is pressed
-
callbackReleasedJSValueA JavaScript function to call when the hotkey is released
Return Value
A hotkey object, or nil if binding failed
hs.hotkey.getKeyCodeMap
Get the system-wide mapping of key names to key codes
Hammerspoon 2/Modules/hs.hotkey/HSHotkeyModule.swift:38
Declaration
hs.hotkey.getKeyCodeMap() -> {[key: string]: number}
Parameters
None
Return Value
A dictionary mapping key names to numeric key codes
hs.hotkey.getModifierMap
Get the mapping of modifier names to modifier flags
Hammerspoon 2/Modules/hs.hotkey/HSHotkeyModule.swift:42
Declaration
hs.hotkey.getModifierMap() -> {[key: string]: number}
Parameters
None
Return Value
A dictionary mapping modifier names to their numeric values