## And Why You Should Be Leveraging This

This post is a part of the software-development series.

If you’re unaware of what a tiling window manager is, check out my previous post on tiling window managers.

As some of you might know, I’m a big fan of tiling window managers. Overall, anything that allows me to use a computer without using the mouse, is a big plus in my book. This not only includes tiling window managers, but also tools like tmux, and customized keyboards that have more ergonomic key setups.

Unfortunately, my favorite tiling window manager i3wm gaps, does not work on OS X. Linux has a lovely feature where it separates the desktop environment from the operating system backend. So one can say run Ubuntu and boot into a Gnome desktop environment, or a KDE environment or even an i3wm gaps environment, all with having the save backend Ubuntu powering their environment. I am a huge fan of this and unfortunately is not matched on say Windows or OS X.

Since I’m now using OS X, due my new company issuing Macbook Pros, I began hunting for an i3wm gaps equivalent on OS X. I’m incredibly grateful to have found Christian Bargmann’s blog post on “So you want i3wm on MacOS?. Christian walks through how we can leverage yabai and skhd together to recreate a pretty big portion of i3wm-gaps.

Yabai is a window management utility, while Skhd is a simple hotkey daemon tool, and together they’re are very powerful and customizable. By using Brew, one can easily install these two programs. _I’d recommend adding yabai and skhd to one’s Brewfile, which I explain why that’s so important in my Brewfile post. Once installed, one configures these two programs by writing configuration files. For example, I’m going to link my .yabairc and skhdrc, take a look at both of these files. Notice how we map all our hotkeys in our skhdrc, this allows us to recreate most of the functionality our i3wm-gaps would grant us, including moving focus between windows, moving windows, making windows fullscreen, and much more. In addition to OS X’s default CMD + arrow, we can move workspaces as well.

We’re unfortunately unable to snap to specific workspaces with hotkeys using Yabai, unless we want to disable some OS X security features. To be super clear, one can still use yabai and skhd without disabling this feature, but not all features are enabled. This led me to look back to using one of my favorite tools on OS X, hammerspoon. Hammerspoon is an incredible tool for automation. It allows you to bind hotkeys to commands, much like Skhd. Additionally, Hammerspoon has a slew of prewritten libraries one can tap into. I’ve grown quite fond of “window hints”, which is when Hammerspoon will display an icon and letter over every window. Simply pressing the corresponding window will result in that window gaining focus. This works on windows that are on different monitors too. We can look at my line in my Hammerspoon config to do this here.

One thing that’s unfortunate about this approach, is that it does not sync with OS X’s internal state of which monitor is active. For example, say you have workspaces 1 and 2 on your left monitor and workspace 3 and 4 on you right. If the right monitor is active and you use the window hint to move to a window on the left, then you use the built in OS X command “CMD + ARROW KEY” to try to move to another workspace on the now active left monitor, OS X will actually move the workspace on the right monitor, as the window hint did not sync the left monitor as being active… This is unfortunate. Additionally, I’ve found that Hammerspoon’s library for adjusting brightness does not work with external monitors. That being said, the tool is lovely and I use it a lot.

Overall, these two tools have made development on OS X close to, but not exactly, as good as using i3wm-gaps on Linux. I highly recommend trying these tools out.

This is a post in the software-development series.
Other posts in this series: