Index

bspwm and sxhkd are a great window manager

The X window system –the most popular graphical environment for Unix operating systems like Linux and *BSD’s– gives its users the option to choose their window manager. A window manager is a program that arranges windows around the screen, and often adds decorations like a title bar with a close button, and maybe a maximize, and minimize button beside. Tiling window managers arrange windows into mutually non-overlapping frames, that’s what I use.

I used to run dwm, and switched to bspwm and sxhkd four weeks ago. These programs work in tandem to manage windows and handle input events, and it’s a beautiful thing.

First here’s an overview of how traditional window management works. Most window managers use something called reparenting, where it becomes the top window and all the other windows are its children. This lets the window manager decorate these sub-windows. A typical event loop handles both the administration of the window and the input events like keyboard, mouse, or touch. That’s a traditional X application event loop.

Bspwm & sxhkd are different, they split the event loop into two different processes; sxhkd pilots bspwm via a command line tool called bspc. The name bspwm comes from BSP or binary space partition, while sxhkd means Simple X hotkey daemon. Sxhkd handles keyboard, mouse, and other input events, and bspwm only handles windows events, and ignore all input events. Sxhkd drives bspwm by mapping hotkey to execution of the bspc command line tool to tell bspwm what to do.

Because of this split configuration is straightforward, there are two different configuration files, instead of one. Since these files have different purposes, they can use different syntax. Sxhkd has a simple and powerful configuration syntax. Each line of the configuration file is interpreted as so:

So if you want to start xterm when pressing the Alt and the Return keys simultaneously, you put the following in sxhkd’s configuration:

alt + Return
    xterm

Bspwm’s configuration is an executable that can be written any language, it’s executed after the window manager starts. The executable is usually a shell script that calls the bspc tool to configure bspwm. Clear configuration & minimalism makes there two programs attractive options.

I use the “default” configuration that comes with sxhkd & bspwm and I the only change I did was to reduce border between windows from 8 pixels to 4. What my thoughts are after 4 weeks? I got used to the new setup within a few days, it was easy to learn coming from dwm, your experience may be different if you have never used a tiling window manager.

bspwm and sxhkd are a great window manager. If you are running dwm, i3, xnomad or some other tilling window manager, they may be a good alternative.