How to set up Mjolnir for window management
After updating my mac to El Capitan, I was about to re-install my habitual window manager (Divvy), but because it’s Sunday, and the grass is always greener elsewhere, I started looking for an alternative.
But then I stumbled on a gem: Mjolnir.
Mjolnir is an OS X app that lets you automate common tasks using the language Lua.
So, yeah. Something even less user friendly than a regular window manager, but I haven’t done any Lua yet and I can sync the config across multiple machines: SOLD. To top it off, the logo is awesome.
How to make Mjolnir resize your windows
First, install Mjolnir and enable accessibility:
$ brew update $ brew install lua
Then we need to install a few modules:
$ luarocks install mjolnir.hotkey $ luarocks install mjolnir.application $ luarocks install mjolnir.bg.grid
You can find the entire list of modules here: http://rocks.moonscript.org/search?q=mjolnir
Now the fun starts, let’s create
~/.mjolnir/init.lua and add a few window resize shortcuts:
While writing the scripts, use the Mjolnir console to reload the file. Just type
The above script is very basic and there’s a lot of repetition. Since we’re basically using a grid based layout, there’s already a module for that: mjolnir.bg.grid
The program then becomes simpler and shorter:
If you want to learn more, I can recommend this blog post: Using Mjolnir