Staggeringly powerful macOS desktop automation with Lua
open sourceMITself-hostablefree
Hammerspoon is a free, MIT-licensed macOS automation tool that bridges the operating system to a Lua scripting engine. Extensions expose windows, applications, screens, keyboard and mouse events, the clipboard, Wi-Fi, audio devices and more, so a Lua config file can bind hotkeys to window moves, build grid or tiling layouts, or react to events like joining a network. Window management is its most common first use, through modules like hs.window and hs.grid and ready-made Spoons such as MiroWindowsManager, WindowHalfsAndThirds and PaperWM.
Ways to install
Package managers
Problems it solves
- write my own window management rules in code instead of living with an app's fixed layouts
- bind a hotkey that moves and resizes several windows into my exact layout
- script my Mac with Lua: hotkeys, windows, Wi-Fi and battery events
- run a set of actions automatically when my laptop joins my home Wi-Fi
- scrolling PaperWM-style window management on macOS as a script I can tweak
- move windows on a grid with keyboard shortcuts I define myself
- react when a monitor is plugged in by rearranging my windows
- a free, open source replacement for several small Mac utilities, configured in one file
Features
- Lua scripting engine bridged to macOS APIs
- hs.window, hs.grid and window filters for window management
- hotkeys and low-level keyboard and mouse event taps
- access to applications, screens, Wi-Fi, audio devices, batteries, clipboard and location services
- Spoons: official repository of ready-made plugins
- hs command-line tool through hs.ipc
- console for running Lua interactively
Limitations
- No ready-made window layouts out of the box: you write Lua in ~/.hammerspoon/init.lua or install Spoons23
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Takes plugins | plan not known |
Alternatives
The same job
These do what Hammerspoon does.
- Rectangle Move and resize windows on macOS with keyboard shortcuts and snap areas
- Moom Move and zoom windows on the Mac
- yabai Tiling window management for the Mac
- AeroSpace An i3-like tiling window manager for macOS
- BetterTouchTool Customize trackpad gestures, the mouse, keyboard shortcuts, the menu bar, Stream Deck and more
- Keyboard Maestro Macro and automation app for macOS