software · Q727
Hammerspoon
Hammerspoon tool for keyboard-driven desktop automation or reusable text expansion.
Overview
Hammerspoon is an open-source macOS automation environment that connects a Lua scripting engine to operating-system APIs. It can coordinate windows, applications, input, clipboard data and system events. It does not provide a finished workflow immediately after installation: users supply a Lua configuration or load suitable extensions.[2]
Lua configuration
The main configuration connects triggers to actions, such as a shortcut that rearranges windows or an event handler responding to an application change. The project exposes macOS capabilities through modules rather than one fixed macro format. This favors users comfortable describing behavior in code and consulting an API reference.[2]
Spoons and reusable modules
Prebuilt plugins called Spoons package reusable behavior. The getting-started guide distinguishes installing a Spoon from loading and activating it in the configuration. A downloaded extension therefore is not automatically a complete working setup; its initialization, options and required dependencies remain part of the workflow.[3]
Runtime behavior
The guide explains that Lua objects such as watchers need retained references or they can be garbage-collected. Reloading configuration destroys the current interpreter and creates another one. These details matter for long-running event automation: a script that creates a watcher once is not enough if its lifetime is not maintained.[3]
Window-management scope
The window API documents that its general window-listing function sees the current Mission Control Space, with additional qualifications for visible displays, hidden applications and minimized windows. A separate window-filter module addresses broader tracking needs. Multi-Space automation should use the appropriate API instead of assuming that every function returns every window on the Mac.[4]
Licensing and access
Hammerspoon is MIT-licensed. Its setup guide calls for Accessibility access to enable relevant desktop-control operations. That permission is a deployment requirement for the intended automation, not proof that a script can manipulate every application without restriction. Older macOS systems may also require a compatible earlier release.[1][2][3]
Substitution considerations
Hammerspoon can substitute for Keyboard Maestro for macOS shortcut-driven window and application automation when Lua-based authoring is acceptable. It offers an API and plugin model rather than direct compatibility with Keyboard Maestro macros. Existing action sequences, triggers and permission requirements must be rebuilt and checked for the specific workflow.[2][3][5]
Capabilities & limitations
All-Space window enumeration
limitedThe general allWindows API is limited to the current Space; broader tracking uses other APIs.[4]
Desktop automation and text expansion · macOS · Operating-system, application and permission requirements apply
1 source · check evidence
allWindows current-Space limit; window.filter alternative
vendor · checked 2026-10-07Can substitute for
These are products or services this entry can replace. Check the task and limitations for each comparison.
Keyboard Maestro for Desktop automation
limitedSuitable for macOS shortcut and event automation when Lua authoring is acceptable; macros must be rewritten.[2][5]
macOS · Operating-system, application and permission requirements apply
References
- Hammerspoon license
MIT license
vendor · retrieved 2026-10-07 - Hammerspoon
macOS Lua bridge; events, windows and configuration requirement
vendor · retrieved 2026-10-07 - Hammerspoon getting started
Accessibility, Lua configuration, Spoons, variable lifetimes and reload
vendor · retrieved 2026-10-07 - Hammerspoon window API
allWindows current-Space limit; window.filter alternative
vendor · retrieved 2026-10-07 - Keyboard Maestro macros
Triggers, ordered actions, application groups; live saving; recorder edits
vendor · retrieved 2026-10-07
Discussion & disputes
Ask about unclear claims or explain a concern with supporting sources. If you have a specific fix, suggest a correction.
No discussion yet.
Revision history
Open a revision to read an earlier version of this article.
| Revision | Timestamp | Edit summary |
|---|---|---|
| 775 | 2026-10-13 05:28:28 | /* wbeditentity-create-item:0| */ sf:dc457422-6db9-4325-bf42-5794a1e05405:v1 | Add Hammerspoon with cited automation scope, platform and configuration limits; no scripts executed, applications installed or permissions changed. | attribution: /proposals/dc457422-6db9-4325-bf42-5794a1e05405 |