luke.b//blog

macOS window management without xmonad

~ #dev

When developing at home, I’ve “settled” for my MacBook Pro (circa 2012) and for the most part it’s been OK. Having multiple “spaces”/desktops and the adjustable split-screen has sufficed; with one space split between a terminal/editor and a web browser and maybe another web browser on another space, with Spotify etc. delegated to subsequent spaces.

But last year, a colleague recommended xmonad and I have not looked back.

It changed my development efficiency dramatically.

xmonad

For anyone unfamiliar with xmonad, it’s a tilling window manager for X, a windowing system commonly found with your favourite *nix OS. For example, you can use it with Ubuntu as a replacement for its default window manager.

A tiling window manager allows you to arrange your windows on your screen such that they don’t overlap. For example:

+------------+---------------+
|            |               |
| Terminal   | Web Browser   |
|            |               |
|            |               |
+------------+---------------+

+------------+---------------+
| Terminal   | Editor        |
|            |               |
+------------+---------------+
| Terminal   | Web Browser   |
|            |               |
+------------+---------------+

+------------+---------------+
| Terminal   | Web Browser   |
|------------|               |
| Terminal   |               |
|------------|               |
| Terminal   |               |
+------------+---------------+

To construct these layouts, xmonad provides a series of fairly simple key combinations to spawn terminals, move tiles around, resize the layout, change the current layout algorithm, change the currently viewed space, etc.

This results in a very quick workflow when developing just using the keyboard. I found myself only resorting to a mouse when using my browser. I also switched to using vim instead of sublime, giving even more mouse freedom.

macOS

But what about macOS? Can xmonad be used on macOS?

In theory yes… but having tried and failed to install it myself by following some ancient instructions for OS X Leopard (first released in 2007), it seems the world has given up getting that particular combination to work. macOS does ship with X, the window server that xmonad interfaces with, but there’s seemingly no recent documentation of this.

Alternatives

There are alternatives, namely Amethyst, which I’ve used to some success. It tries to mimic xmonad but falls short of providing exactly the same experience, which is expected.

You’d be better off running Ubuntu on your Mac (unless you care about macOS or Aqua (macOS default GUI) or any macOS apps that don’t have linux equivalents). I haven’t actually tried this as I’m one of (I’m sure) many that enjoy running macOS.

Alternative alternative

Having flipped between a few different solutions to this problem, I’ve finally settled on a sub-optimal but somewhat satisfactory setup. It might not impress but the simplicity has allowed for a similar efficiency to that of using xmonad on Ubuntu. It revolves heavily around macOS split-screen and space switching using the 4-finger sideways swipe gesture on the touchpad.

Space 1

Split multi-tab terminal with browser.

With multiple terminal tabs in a single left-most column of my screen, I can delegate a task per tab:

  1. editor: daily task log/diary
  2. output: automatic build logs
  3. editor: code
  4. bash: for adding dependencies, repls, git

Being able to create/delete/move between tabs is usually enough for most of my workflows. Reordering tabs can only be done with the mouse unfortunately. Cmd-tab is of course available for switching between the browser and the terminal.

The right-most column is delegated to a web browser, for either documentation or a web app I’m working on.

Space 2

Web browser

This is pretty self-explanatory. Usually containing more documentation/twitter/YouTube/etc.

Space 3

Desktop

Because who doesn’t want a nice glossy photo they took recently cluttered with a few stray windows and icons?

Conclusion

Anyway, that’s me doing me. You do you! There are plenty of window management options for all operating systems and I can only highly recommend not settling or becoming dependent on a particular operating system for the windowing system it affords.

And the sooner the better - maybe you’re wasting tens of seconds looking for that one window that’s floating somewhere on one of your 20 spaces. Or that one browser tab that you know you were looking at just moments ago…

Those seconds build up without you knowing! Always question whether your current setup/editor/OS is right for you! 😊

Please feel free to comment about xmonad or your experiences managing your dev setup.

Follow me for more like this 🚀