hs
Core Hammerspoon functionality
- Constants - Useful values which cannot be changed
- Variables - Configurable values
- Functions - API calls offered directly by the extension
Signature | hs.configdir |
Type | Constant |
Description | A string containing Hammerspoon's configuration directory. Typically ~/.hammerspoon/ |
Signature | hs.docstrings_json_file |
Type | Constant |
Description | A string containing the full path to the docs.json file inside Hammerspoon's app bundle. This contains the full Hammerspoon API documentation and can be accessed in the Console using help("someAPI") . It can also be loaded and processed by the hs.doc extension |
Signature | hs.processInfo |
Type | Constant |
Description | A table containing read-only information about the Hammerspoon application instance currently running. |
Signature | hs.accessibilityStateCallback |
Type | Variable |
Description | An optional function that will be called when the Accessibility State is changed. |
Notes |
|
Signature | hs.completionsForInputString(completionWord) -> table of strings |
Type | Variable |
Description | Gathers tab completion options for the Console window |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.dockIconClickCallback |
Type | Variable |
Description | An optional function that will be called when the Hammerspoon Dock Icon is clicked while the app is running |
Notes |
|
Signature | hs.fileDroppedToDockIconCallback |
Type | Variable |
Description | An optional function that will be called when a files are dragged to the Hammerspoon Dock Icon or sent via the Services menu |
Notes |
|
Signature | hs.shutdownCallback |
Type | Variable |
Description | An optional function that will be called when the Lua environment is being destroyed (either because Hammerspoon is exiting or reloading its config) |
Notes |
|
Signature | hs.textDroppedToDockIconCallback |
Type | Variable |
Description | An optional function that will be called when text is dragged to the Hammerspoon Dock Icon or sent via the Services menu |
Notes |
|
Signature | hs.accessibilityState(shouldPrompt) -> isEnabled |
Type | Function |
Description | Checks the Accessibility Permissions for Hammerspoon, and optionally allows you to prompt for permissions. |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.allowAppleScript([state]) -> bool |
Type | Function |
Description | Set or display whether or not external Hammerspoon AppleScript commands are allowed. |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.autoLaunch([state]) -> bool |
Type | Function |
Description | Set or display the "Launch on Login" status for Hammerspoon. |
Parameters |
|
Returns |
|
Signature | hs.automaticallyCheckForUpdates([setting]) -> bool |
Type | Function |
Description | Gets and optionally sets the Hammerspoon option to automatically check for updates. |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.cameraState(shouldPrompt) -> boolean |
Type | Function |
Description | Checks the Camera Permissions for Hammerspoon, and optionally allows you to prompt for permissions. |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.canCheckForUpdates() -> boolean |
Type | Function |
Description | Returns a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates. |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.checkForUpdates([silent]) -> none |
Type | Function |
Description | Check for an update now, and if one is available, prompt the user to continue the update process. |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.cleanUTF8forConsole(inString) -> outString |
Type | Function |
Description | Returns a copy of the incoming string that can be displayed in the Hammerspoon console. Invalid UTF8 sequences are converted to the Unicode Replacement Character and NULL (0x00) is converted to the Unicode Empty Set character. |
Parameters |
|
Returns |
|
Notes |
|
Signature | hs.closeConsole() |
Type | Function |
Description | Closes the Hammerspoon Console window |
Parameters |
|
Returns |
|
Signature | hs.closePreferences() |
Type | Function |
Description | Closes the Hammerspoon Preferences window |
Parameters |
|
Returns |