Window management on macos

Having right tool to manage application windows helps to increase productivity, saves time by automating daily routine task of arranging windows for different workspace and screen configurations.

I used Slate for a long time for this specific task, move and resize windows with precision and launching multiple application at once all done by single key shortcut. Even today Slate is one of the good options even it appears to be not maintained anymore. I’d like to automate more daily routine tasks that’s why I switched to Hammerspoon.

Windows moves to top left cornet after a keyboard shortcut.
Takes exactly one third width of the screen.

Hammerspoon is not very different from Slate in terms of how they control windows and both very good at for that. Easy integration with the operating system is where Hammerspoon shines more. It does this by using the Lua language.

Connecting and controlling almost any operating system service and device is possible thanks to Lua and there are already many ready to use plugins for common use cases. Addition to having a batteries included system Hammerspoon also provides watchers for different operating system events including but not limited to application launch, focus change, connected network change, usb device connection status. The API documentation lists all available watchers.

Screen watcher is one of the powerful watchers, it notifies when screen configuration changes, whenever a new screen connects or disconnects. Listening screen change events allows easy window arrangement for different screen configurations. When desktop and laptop screen are connected the main IDE may take full desktop screen real estate while other application windows such as browsing, mail, music listening may rest on the laptop screen. When laptop lid is closed and the desktop screen becomes the only available space all windows will find their place on the screen and take the exact space each and every time as they configured.

Windows find their place on the screen after a key shortcut or automatically when screen configuration changes.

Although it has many powerful capabilities Hammerspoon is not a tool you just install and expect it to be useful. You first need to configure it. For the journey of the configuration, the big help comes from user samples all over the world even the API documentation details everything.

To get started, follow nicely put sample configurations for inspiration and don’t forget to check out plugins page to get an idea of what can be done. I’ve also shared my current configuration on Github and will try update as it evolves.