Configure and manage Hammerspoon automation, app launching, and window switching...
Manage Hammerspoon configuration for macOS automation including app launching, window switching, emoji/symbol pickers, and leader modal. Window management is handled by AeroSpace.
~/.config/hammerspoon/~/.hammerspoon → ~/.config/hammerspoon/hs (installed via hs.ipc.cliInstall() in init.lua)hyper-key.lua - Inline hyper key implementation
HyperKey.new(mods) constructorbind(key):toFunction(name, fn) and bind(key):toApplication(app)self.bindings tableinit.lua - Main entry point
hs.ipc.cliInstall() to enable CLI accesshyper modifier: {cmd, ctrl, alt, shift}leader-modal.lua - Modal keybinding system
leader-dsl.lua - DSL for defining leader bindings
Leader(key, description, bindings) - Define leader menuBind(key, description, action, options) - Define action~/.config/hammerspoon/clues/ directoryclues/*.lua - Leader binding definitions
windows.lua - Window management (moved to AeroSpace)hammerspoon.lua - Reload config, console, update apps, switcherapps.lua - App launchingsystem.lua - System operationscleanshot.lua - CleanShot integrationemoji.lua - Emoji pickersuperwhisper.lua - SuperWhisper integrationemoji-picker.lua - Emoji chooser
symbol-picker.lua - Symbol chooser
chooser-style.lua - Shared chooser styling
window-switcher.lua - Unified launcher/dispatcher modal
hs.chooser API with fuzzy matchingcmd+space and cmd+tabfuzzy.lua - Dynamic programming fuzzy matching
notch-clock.lua - Clock in notch area
The hs command-line tool provides direct interaction with Hammerspoon. It requires hs.ipc.cliInstall() to be called in init.lua (already configured).
Check for errors and module status:
echo "
local status = {modules_loaded = {}, errors = {}}
local modules = {'hyper-key', 'config-watch', 'window-hotkeys', 'quick-switch', 'window-switcher'}
for _, mod in ipairs(modules) do
local ok, result = pcall(require, mod)
if ok then
table.insert(status.modules_loaded, mod)
else
table.insert(status.errors, mod .. ': ' .. tostring(result))
end
end
return hs.json.encode(status, true)
" | hs -c ''
View live console output:
hs -C
Execute Hammerspoon commands:
echo "hs.alert.show('test')" | hs -c ''
echo 'hs.reload()' | hs -c ''
Interactive Lua REPL:
hs
Mirror prints to console:
hs -P
Run a script:
hs /path/to/script.lua
Common flags:
-A - Auto-launch Hammerspoon if not running-C - Clone console prints to this terminal (best for checking errors)-P - Mirror prints to Hammerspoon console-c - Execute command and return result-i - Force interactive mode-n - Disable colorized output-N - Force colorized output-q - Quiet mode (errors and results only)Reload Hammerspoon:
echo 'hs.reload()' | hs -c ''
# or via URL:
open -g hammerspoon://reload
Check if running:
ps aux | rg -i hammerspoon
Open console window:
open "hammerspoon://consoleWindow"
Test configuration:
Edit any .lua file in ~/.config/hammerspoon/ to trigger auto-reload
Create a file in ~/.config/hammerspoon/clues/:
return Leader("key", "Description", {
Bind("a", "Action 1", { fn = function() ... end }),
Bind("b", "Action 2", { shell = "/path/to/script" }),
Bind("c", "Action 3", { mode = "mode_name" }),
})
~/.config/hammerspoon/module-name.luainit.lua: local module = require("module-name")Current Hammerspoon setup replaces:
Other macOS automation tools:
Use the hs CLI to check for module loading errors:
echo "
local status = {modules_loaded = {}, errors = {}}
local modules = {'hyper-key', 'config-watch', 'window-hotkeys', 'quick-switch', 'window-switcher'}
for _, mod in ipairs(modules) do
local ok, result = pcall(require, mod)
if ok then
table.insert(status.modules_loaded, mod)
else
table.insert(status.errors, mod .. ': ' .. tostring(result))
end
end
return hs.json.encode(status, true)
" | hs -c ''
Or view live console output: hs -C
ls -la ~/.hammerspoonps aux | rg Hammerspoonecho 'hs.reload()' | hs -c ''hs -C or open "hammerspoon://consoleWindow"echo "hs.alert.show('test')" | hs -c ''config-watch.lua is loaded in init.lua.luaIf hs command not found, ensure hs.ipc.cliInstall() is called in init.lua
Decision criteria for using spoons:
Future spoon management (not yet implemented): If spoons are needed, they will be managed via GitHub workflow:
.github/workflows/versions.lua.github/workflows/hammerspoon.yml build workflowhammerspoon-YYYY.MM.DD-darwin-arm64.tar.gzThis ensures pinned, reproducible spoon dependencies similar to other tools in the repo.
init.lua~/.claude/plans/hammerspoon-consolidation.md