Using chunkwm as a window manager

Using chunkwm as a window manager

When working with multiple windows or applications simultaneously, it can be hugely advantageous to be able to switch between these different windows and contexts as fluidly as possible, reducing any friction or downtime.

While this can apply to many types of work, this is certainly the case in development environments. chunkwm is a tiling window manager for macOS that allows users to rapidly switch between application windows, automatically resizing each window based on user preferences or optimized defaults, and many other features that make a modern digital workflow far more seamless.

This blog post will give a walkthrough of setting up chunkwm for Mac OS X, and some of its basic uses.

 

Installing chunkwm

The easiest way to install chunkwm is via Homebrew. In addition to chunkwm, we will also need to install skhd, which is the hotkey daemon for setting up the keyboard shortcuts for chunkwm. We can install both with Homebrew via the following three commands:

brew tap crisidev/homebrew-chunkwm
brew install --HEAD --with-tmp-logging chunkwm
brew install --HEAD --with-logging  koekeishiya/formulae/skhd

 

Both chunkwm and skhd can also be launched via Homebrew:

brew services start chunkwm
brew services start skhd

 

RC file configuration

Configuration for chunkwm is handled in the .chunkwmrc file, which should be saved to the home directory (~). It’s recommended to start with the example template it comes with, saving this as your starting .chunkwmrc. After setting up the .chunkwmrc file, you’ll need to add execution permissions to the file. You can do so via the following command:

chmod +x ~/.chunkwmrc

 

Some settings worth noting in .chunkwmrc are the offset and gap settings:

chunkc set global_desktop_offset_top     8
chunkc set global_desktop_offset_bottom  8 
chunkc set global_desktop_offset_left    8
chunkc set global_desktop_offset_right   8
chunkc set global_desktop_offset_gap     8

 

These will set the offset in pixels from the sides of the screen, as well as the gap between windows.

skhd, the hotkey daemon, has its own separate config file as well, .skhdrc. This should also be saved in your home directory. .skhdrc is where all key bindings for chunkwm will be configured. The project comes with its own starter template, although any of the keybindings can be modified and customized, provided they don’t conflict with any other bindings.

shihanng’s .skhdrc is a good starting place to learn the main functions of chunkwm. It’s recommended to start with their file as an example.

Basic commands

While the commands of chunkwm can be mapped to any keys, it’s very common for key bindings to be similar to those in the Vim text editor. For example in the example .skhdrc file, alt + h, j, k, or l will navigate left, up right or down to the next window, giving it focus. alt + p or n can be used to give focus to the previous or next window.

Similarly window positions can be moved, using the h, j, k or l keys, in conjunction with shift and alt. For example, let’s say we has four open windows, each taking up a quarter of the screen. If the bottom right window currently has focus, we can switch the position of this window with the one in the top right by pressing alt + shift + k.

Resources

Post a Comment

Comments are moderated. Your email is kept private. Required fields are marked *

© 2019 Sunlight Media LLC