Core Hammerspoon functionality
Signature | hs.configdir |
---|---|
Type | Constant |
Description | A string containing Hammerspoon's configuration directory. Typically |
Source | extensions/_coresetup/_coresetup.lua line 44 |
Signature | hs.docstrings_json_file |
---|---|
Type | Constant |
Description | A string containing the full path to the |
Source | extensions/_coresetup/_coresetup.lua line 144 |
Signature | hs.processInfo |
---|---|
Type | Constant |
Description | A table containing read-only information about the Hammerspoon application instance currently running. |
Source | Hammerspoon/MJLua.m line 228 |
Signature | hs.accessibilityStateCallback |
---|---|
Type | Variable |
Description | An optional function that will be called when the Accessibility State is changed. |
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 66 |
Signature | hs.completionsForInputString(completionWord) -> table of strings |
---|---|
Type | Variable |
Description | Gathers tab completion options for the Console window |
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 584 |
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 |
|
Source | extensions/_coresetup/_coresetup.lua line 49 |
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 |
|
Source | extensions/_coresetup/_coresetup.lua line 82 |
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 |
|
Source | extensions/_coresetup/_coresetup.lua line 57 |
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 |
|
Source | extensions/_coresetup/_coresetup.lua line 74 |
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 |
|
Source | Hammerspoon/MJLua.m line 274 |
Signature | hs.allowAppleScript([state]) -> bool |
---|---|
Type | Function |
Description | Set or display whether or not external Hammerspoon AppleScript commands are allowed. |
Parameters |
|
Returns |
|
Notes |
|
Source | Hammerspoon/MJLua.m line 674 |
Signature | hs.autoLaunch([state]) -> bool |
---|---|
Type | Function |
Description | Set or display the "Launch on Login" status for Hammerspoon. |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 66 |
Signature | hs.automaticallyCheckForUpdates([setting]) -> bool |
---|---|
Type | Function |
Description | Gets and optionally sets the Hammerspoon option to automatically check for updates. |
Parameters |
|
Returns |
|
Notes |
|
Source | Hammerspoon/MJLua.m line 491 |
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 |
|
Source | Hammerspoon/MJLua.m line 432 |
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 |
|
Source | Hammerspoon/MJLua.m line 625 |
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 |
|
Source | Hammerspoon/MJLua.m line 550 |
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 |
|
Source | Hammerspoon/MJLua.m line 764 |
Signature | hs.closeConsole() |
---|---|
Type | Function |
Description | Closes the Hammerspoon Console window |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 178 |
Signature | hs.closePreferences() |
---|---|
Type | Function |
Description | Closes the Hammerspoon Preferences window |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 148 |
Signature | hs.consoleOnTop([state]) -> bool |
---|---|
Type | Function |
Description | Set or display whether or not the Hammerspoon console is always on top when visible. |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 102 |
Signature | hs.coroutineApplicationYield([delay]) |
---|---|
Type | Function |
Description | Yield coroutine to allow the Hammerspoon application to process other scheduled events and schedule a resume in the event application queue. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 106 |
Signature | hs.dockIcon([state]) -> bool |
---|---|
Type | Function |
Description | Set or display whether or not the Hammerspoon dock icon is visible. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 262 |
Signature | hs.execute(command[, with_user_env]) -> output, status, type, rc |
---|---|
Type | Function |
Description | Runs a shell command, optionally loading the users shell environment first, and returns stdout as a string, followed by the same result codes as |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 231 |
Signature | hs.focus() |
---|---|
Type | Function |
Description | Makes Hammerspoon the foreground app. |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 734 |
Signature | hs.getObjectMetatable(name) -> table or nil |
---|---|
Type | Function |
Description | Fetches the Lua metatable for objects produced by an extension |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 748 |
Signature | hs.help(identifier) |
---|---|
Type | Function |
Description | Prints the documentation for some part of Hammerspoon's API and Lua 5.3. This function is actually sourced from hs.doc.help. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 370 |
Signature | hs.hsdocs([identifier]) |
---|---|
Type | Function |
Description | Display's Hammerspoon API documentation in a webview browser. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 393 |
Signature | hs.loadSpoon(name[, global]) -> Spoon object |
---|---|
Type | Function |
Description | Loads a Spoon |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 282 |
Signature | hs.microphoneState(shouldPrompt) -> boolean |
---|---|
Type | Function |
Description | Checks the Microphone Permissions for Hammerspoon, and optionally allows you to prompt for permissions. |
Parameters |
|
Returns |
|
Notes |
|
Source | Hammerspoon/MJLua.m line 373 |
Signature | hs.open(filePath) |
---|---|
Type | Function |
Description | Opens a file as if it were opened with /usr/bin/open |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 192 |
Signature | hs.openAbout() |
---|---|
Type | Function |
Description | Displays the OS X About panel for Hammerspoon; implicitly focuses Hammerspoon. |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 117 |
Signature | hs.openConsole([bringToFront]) |
---|---|
Type | Function |
Description | Opens the Hammerspoon Console window and optionally focuses it. |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 162 |
Signature | hs.openConsoleOnDockClick([state]) -> bool |
---|---|
Type | Function |
Description | Set or display whether or not the Console window will open when the Hammerspoon dock icon is clicked |
Parameters |
|
Returns |
|
Notes |
|
Source | Hammerspoon/MJLua.m line 710 |
Signature | hs.openPreferences() |
---|---|
Type | Function |
Description | Displays the Hammerspoon Preferences panel; implicitly focuses Hammerspoon. |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 132 |
Signature | hs.preferencesDarkMode([state]) -> bool |
---|---|
Type | Function |
Description | Set or display whether or not the Preferences panel should display in dark mode. |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 652 |
Signature | hs.printf(format, ...) |
---|---|
Type | Function |
Description | Prints formatted strings to the Console |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 13 |
Signature | hs.rawprint(aString) |
---|---|
Type | Function |
Description | The original Lua print() function |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 205 |
Signature | hs.relaunch() |
---|---|
Type | Function |
Description | Quits and relaunches Hammerspoon. |
Parameters |
|
Returns |
|
Source | extensions/_coresetup/_coresetup.lua line 92 |
Signature | hs.reload() |
---|---|
Type | Function |
Description | Reloads your init-file in a fresh Lua environment. |
Parameters |
|
Returns |
|
Source | Hammerspoon/MJLua.m line 212 |
Signature | hs.screenRecordingState(shouldPrompt) -> isEnabled |
---|---|
Type | Function |
Description | Checks the Screen Recording Permissions for Hammerspoon, and optionally allows you to prompt for permissions. |
Parameters |
|
Returns |
|
Notes |
|
Source | Hammerspoon/MJLua.m line 347 |
Signature | hs.showError(err) |
---|---|
Type | Function |
Description | Shows an error to the user, using Hammerspoon's Console |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 149 |
Signature | hs.toggleConsole() |
---|---|
Type | Function |
Description | Toggles the visibility of the console |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/_coresetup/_coresetup.lua line 181 |
Signature | hs.updateAvailable() -> string or false, string |
---|---|
Type | Function |
Description | Gets the version & build number of an available update |
Parameters |
|
Returns |
|
Notes |
|
Source | Hammerspoon/MJLua.m line 589 |
Signature | hs.uploadCrashData([state]) -> bool |
---|---|
Type | Function |
Description | Get or set the "Upload Crash Data" preference for Hammerspoon |
Parameters |
|
Returns |
|
Notes |
|
Source | Hammerspoon/MJLua.m line 47 |