DEV Community

Cover image for macOS window management without xmonad
Luke Barnard
Luke Barnard

Posted on

macOS window management without xmonad

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   |               |
+------------+---------------+ 

Enter fullscreen mode Exit fullscreen mode

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 🚀

Top comments (13)

Collapse
 
rpalo profile image
Ryan Palo

You've probably heard of Spectacle for Mac, but, for anybody who hasn't, that's what I use for my window/space splitting. I like it because I can split and tweak the sizes quickly. It's not a full tiling manager, but it does what I need :)

Collapse
 
luke profile image
Luke Barnard • Edited

Spectacle looks like a simple alternative - easy to install and a GUI to change settings.

If only it prevented windows overlapping and handled macOS spaces.

Update: if you haven't seen it chunkwm and skhd is a really solid combination to achieve a very customisable setup (non-overlapping and handling of macOS desktops). It took me a couple of hours to set up something similar to xmonad and I'll probably write a post about that soon.

Collapse
 
crongm profile image
Carlos Garcia ★

More love for Spectacle. After moving from Windows 10 a month ago I was missing its simple but effective window snapping functionality. Spectacle does the job. It's only missing mouse triggers, but there are so many keyboard shortcuts to make up for it.

Collapse
 
paustint profile image
Austin Turner

Spectacle is a lifesaver, I am crippled without it.

Collapse
 
salunmarvin profile image
Salun Marvin

My favorite too. The first thing I do when installing macOS is install Spectacle.

Collapse
 
rad_hombre profile image
Matthew Orndoff

Yep. I use this as well. For me, MacOS is unusable without it.

Collapse
 
awave profile image
Artem Golovin
Collapse
 
luke profile image
Luke Barnard

Having installed those two as suggested, I'm really pleased with the result - it's much closer to xmonad but so much more flexible than xmonad.

I think I'll write a post about how to achieve near-xmonad experience with these.

Thanks again for the pointer, this should get more votes imo :D

Collapse
 
awave profile image
Artem Golovin

No worries, glad I could help!

Collapse
 
luke profile image
Luke Barnard • Edited

You've done the classic mixing of markdown hyperlink syntax. Also, putting "//" prefix uses the same protocol as the current page (http or https):

[chunkwm](//github.com/koekeishiya/chunkwm)
and
[skhd](//github.com/koekeishiya/skhd)

i.e.
chunkwm
skhd

(btw, the way I remember the order of the brackets is "squares before paren's" - it sort of rhymes and has not failed so far)

Collapse
 
luke profile image
Luke Barnard

chunkwm looks very very interesting, I will certainly give that a go. The key thing I notice is that it supports moving focus of windows and it looks highly configurable, like xmonad.

Thanks you for the suggestion!

(Also, this tutorial looks like a good place to get started, for anyone interested.)

Collapse
 
nssimeonov profile image
Templar++

2 terminals on one side, browser and editor on the other... because who actually needs to see more than 5 lines of code?

Collapse
 
luke profile image
Luke Barnard

If anyone is interested in following a project of mine that attempts to recreate xmonad's UX within any ANSI/VT-100 terminal, see nomad