daniebker

How to setup a tiling window manager on macos

· [Daniel Baker]

I’ve been looking for the macos equivalent of i3-gaps for a long time. I love the simplicity a tiling window manager adds by laying out all the windows in a space equally. Combine that with the flexibility to quickly move and resize windows around with the keyboard and everything feels so effortless.

I tried Magnet for a while. Ultimately it fell way short for me. I like the asthetic of small gaps between my windows. It allows everything to breath while maintaining a clean and organised feeling. It also doesn’t use Binary Space Partitioning (BSP), every time I opened a new window in a space it needed to be given it’s own area to occupy. Having to arrange the windows every time using the keyboard short cuts was fine, but an extra step I didn’t want to take. On top of that, resizing windows didn’t force the other windows to resize in the same space which leaves everything feeling super clunky.

Figure 1: Yabai tiling emacs, firefox, and iterm

Figure 1: Yabai tiling emacs, firefox, and iterm

Enter yabai. Yabai is essentially an i3-gaps implementation for macos and I love it. It works perfectly for my use case. Using BSP to maximise a space’s area. It also allows me to create those pretty little gaps between windows. Combining this with another package, skhd, and the whole thing feels a lot like i3-gaps setup I have on my linux box. Bliss, at last.

In this post I won’t go into detail on how to setup yabai or skhd since the github documentation covers the basics well. But, I will share my notes of setting it up, as well as my config files, because somethings were not so clear in the documentation.

1. Disabling System Integrity protection

This is an optional step, and one I skipped. All of the features on offer by disabling SIP didn’t appeal to me. Since this is also my work laptop it didn’t make sense as something to disable. But, if you’re fine with that kind of thing then go right ahead. Here’s a list of features that are unlocked by disabling SIP.

2. Install Yabai

Follow the steps on the github page to install Yabai. If you didn’t disable SIP you can skip over the scripting additions.

Before stating Yabai you need to disable a few features and restart your session for the changes to take effect. The following mission control settings need to be enabled for yabai to work properly.

Figure 2: Mission control settings for yabai

Figure 2: Mission control settings for yabai

After setting the mission control settings you can then create the config file /.yabairc. I have mine stored in my dotfiles repo in github. I won’t go into detail what all of the commands do as they are very well documented over on the projects github repository.

After installing you can start Yabai using brew.

3. skhd for keyboard shortcuts

Finally you can pull everything together with the skhd package. This allows you to easily set up keybindings for all the commands listed above. Allowing you to swap windows, resize them, switch spaces and more. I have most of mine mapped to the same keybindings I have in i3-gaps, however, I’m still working out some of the kinks as I slowly figure out which key combinations are clashing with the existing mac ones. You can find my config here.

Conclusion

Other than a few kinks I still need to work out I’m utterly besotted with yabai and skhd. It blows magnet out the water for me, although I can appreciate for some magnet is much easier to use. However, the bredth of functionality availible in yabai is amazing and well worth a look for anyone hankering for that i3-gaps experience on macos.