Justin Wyne

View Original

Mac OSX Window Management with Hammerspoon

Hammerspoon is a really powerful but simple automation tool for OSX.

Below, I show the Lua script that I use to make Hammerspoon my basic OSX keyboard controlled window manager to move and resize windows easily.

What it looks like

Note: The key bindings are only showing for demonstration purposes. Those overlays won’t show for you.

See this content in the original post

The Hammerspoon Script

See this content in the original post

How to use

It’s pretty self explanatory from the code above, but you can customize the animation duration and the grid sizing to your liking.

Note: to make these modifier keys more ergonomic, I recommend remapping your Caps Lock key to Control. You can do so in System Preferences -> Keyboard -> Modifier Keys.

Hotkeys:

Ctrl + Opt + j : Move window down
Ctrl + Opt + k : Move window up
Ctrl + Opt + h : Move window left
Ctrl + Opt + l : Move window right

Ctrl + Cmd + j : Resize window down
Ctrl + Cmd + k : Resize window up
Ctrl + Cmd + h : Resize window left
Ctrl + Cmd + l : Resize window right