Prevents background apps from stealing focus on macOS. It ensures the app or window you selected stays focused until you explicitly choose something else — even when other apps open in the background.
Supports Cmd+Tab, Dock clicks, and custom hotkey support (e.g., for iTerm2 or similar tools).
- Install Hammerspoon
- Download the latest code
- Double-click the downloaded
.spoonfile to install it in your Hammerspoon directory - Add the following to your
~/.hammerspoon/init.lua:
-- Load the spoon
hs.loadSpoon("HocusFocus")
-- Start focus protection
spoon.HocusFocus:start()