Hammerspoon boasts two things: a truly epic project name and a lua scripting environment that hooks into extensions that allow you to control system functionality in macOS. Over the years, it has completely changed how I do a couple small but important tasks. Hammerspoon is a generic tool, but the functionality I use by far the most is window layout management.
Navigating windows with the mouse is inefficient (it takes much longer than with the keyboard) and also somewhat ineffective (it is much less precise than with the keyboard). In order to use the keyboard for window management we first need to be able to navigate with the keyboard
So, first things first:
Cmd+Shift+Tab switches the current window to the next (or previous) application. Similarly,
Cmd+Shift+` switch the current window to the next (or previous) window of the current application
Using the mouse is bad for navigating windows, it is worse for managing their layout. Install Hammerspoon and either install a “spoon” (that’s what they call extensions) like MiroWindowsManager or download my custom configuration and adapt it to your needs. Whichever solution you choose, the result is that you can now move to windows next to each other with lighting speed with a couple keystrokes and the windows will sit perfectly next to each other without overlapping.
Let’s say I want to move VSCode next to iTerm:
Cmd+Tab (repeat until I am on VSCode) … Cmd+Opt+Ctrl+m … <- …
Cmd+Tab (repeat until I am on iTerm) … Cmd+Opt+Ctrl+m … ->
The key combos may look gross, but once they become muscle memory, you’ll navigate and manage windows so quickly, you won’t want to go back!