« Back to Index

macOS: automation with Hammerspoon

View original Gist on GitHub

Tags: #hammer #hammerspoon #os #automation #macos #shell #lua

1. README.md

You need to install Hammerspoon and setup a ~/.hammerspoon/init.lua.

Examples can be found here: https://www.hammerspoon.org/go/#helloworld

init.lua

hs.hotkey.bind({"cmd"}, "escape", function()
  local ghostty = hs.application.find("Ghostty")
  if ghostty and ghostty:isFrontmost() then
    ghostty:hide()
  else
    hs.application.launchOrFocus("Ghostty")
  end
end)