Hammerspoon provides a suite of core productivity tools I rely on in my daily workflow.
The Hammerspoon framework makes it easy to interact with the macOS. You can create custom tools and automations or use pre-built ones from the community, called Spoons. With hotkey bindings, using Spoons becomes seamless and intuitive.
While Hammerspoon has an official Spoon repository, you can also find Spoons elsewhere online. If you're interested in making custom automations, Hammerspoon offers a powerful and well-documented API.
Below are some community-created Spoons that are essential to my day-to-day:
- Caffeine - Prevents your Mac from sleeping
- ShiftIt - Essential window management
- SpoonInstall - Highly recommended for managing your Spoons
Hammerspoon uses a config file at ~/.hammerspoon/init.lua
, which loads automatically when Hammerspooon starts.
Below is my init.lua
file as of writing. For the latest version, check my dotfiles on Github.
shortcut_keys = { "ctrl", "alt" }
-- Once installed SpoonInstall automatically installs the other Spoons below
hs.loadSpoon("SpoonInstall")
spoon.SpoonInstall:andUse(
"Caffeine",
{
start = true,
hotkeys = {
toggle = {shortcut_keys, "c"}
},
}
)
-- ShiftIt is not available on the official Spoon repository, but can be installed by providing SpoonInstall with the repo URL
spoon.SpoonInstall.repos.ShiftIt = {
url = "https://github.com/peterklijn/hammerspoon-shiftit",
desc = "ShiftIt spoon repository",
branch = "master",
}
spoon.SpoonInstall:andUse(
"ShiftIt",
{
repo = "ShiftIt",
hotkeys = {},
}
)
I manage my Hammerspoon config with Chezmoi. As you may have guessed, I have a post on managing dotfiles with Chezmoi.
Stay tuned - I'm currently creating and open-sourcing my first Spoon for Hammerspoon!