From ArchWiki
Jump to navigation Jump to search

bspwm is a tiling window manager that represents windows as the leaves of a full binary tree. It has support for EWMH and multiple monitors, and is configured and controlled through messages.


Install bspwm and sxhkd, or the development versions: bspwm-gitAUR and sxhkd-gitAUR. Sxhkd is a simple X hotkey daemon used to communicate with bspwm through bspc as well as launch your applications of choice.

To start bspwm on login, add the following to ~/.xinitrc or ~/.xprofile (depending on how you launch X/your display manager):

sxhkd &
exec bspwm


Example configuration is found at /usr/share/doc/bspwm/examples/ and on GitHub.

Important: Make you sure environment variable $XDG_CONFIG_HOME is set or your bspwmrc will not be found. This can be done by adding XDG_CONFIG_HOME="$HOME/.config" and export XDG_CONFIG_HOME to your ~/.profile.

Create ~/.config/bspwm/ and ~/.config/sxhkd/, then copy /usr/share/doc/bspwm/examples/bspwmrc to ~/.config/bspwm/ and /usr/share/doc/bspwm/examples/sxhkdrc to ~/.config/sxhkd/. Make bspwmrc executable with chmod +x ~/.config/bspwm/bspwmrc.

These two files are where you will be setting wm settings and keybindings, respectively. See bspwm/Example configurations for annotated examples.

Documentation for bspwm is found by running man bspwm.

There is also documentation for sxhkd found by running man sxhkd.

Note for multi-monitor setups

The example bspwmrc configures ten desktops on one monitor like this:

bspc monitor -d I II III IV V VI VII VIII IX X

You will need to change this line and add one for each monitor, similar to this:

bspc monitor DVI-I-1 -d I II III IV
bspc monitor DVI-I-2 -d V VI VII
bspc monitor DP-1 -d VIII IX X

You can use `xrandr -q` or `bspc query -M` to find the monitor names.

The total number of desktops were maintained at ten in the above example. This is so that each desktop can still be addressed with 'super + {1-9,0}' in the sxhkdrc.


There are two ways to set window rules (as of cd97a32).

The first is by using the built in rule command, as shown in the example bspwmrc:

bspc rule -a Gimp desktop=^8 follow=on state=floating
bspc rule -a Chromium desktop=^2
bspc rule -a mplayer2 state=floating
bspc rule -a focus=on
bspc rule -a Screenkey manage=off

The second option is to use an external rule command. This is more complex, but can allow you to craft more complex window rules. See these examples for a sample rule command.

If a particular window does not seem to be behaving according to your rules, check the class name of the program. This can be accomplished by running xprop | grep WM_CLASS to make sure you're using the proper string.


An example panel for bar is provided in the examples folder on the GitHub page. You might also get some insights from the Bar wiki page. The panel will be executed by placing panel & in your bspwmrc. Check the opt-depends in the bspwm package for dependencies that may be required.

To display system information on your status bar you can use various system calls. This example will show you how to edit your panel to get the volume status on your BAR:

        volStatus=$(amixer get Master | tail -n 1 | cut -d '[' -f 4 | sed 's/].*//g')
        volLevel=$(amixer get Master | tail -n 1 | cut -d '[' -f 2 | sed 's/%.*//g')
        # is alsa muted or not muted?
        if [ "$volStatus" == "on" ]
                echo "%{Fyellowgreen} $volLevel %{F-}"
                # If it is muted, make the font red
                echo "%{Findianred} $volLevel %{F-}"

Next, we will have to make sure it is called and piped to $PANEL_FIFO:

while true; do
echo "S" "$(panel_volume) $(panel_clock) > "$PANEL_FIFO"
        sleep 1s
done &


You can emulate a scratchpad (like i3's) by adding a shortcut for this command:

xdotool search --onlyvisible --classname scratchpad windowunmap \
|| xdotool search --classname scratchpad windowmap \
|| st -c scratchpad -g 1000x400+460 &

and adding this rule:

bspc rule -a scratchpad sticky=on state=floating

See also [1] and [2].

For a scratch-pad which can use any window type without pre-defined rules, see: [3]

For a more sophisticated scratchpad script that supports many terminals out of the box and has flags for doing things like optionally starting a tmuxinator/tmux session, turning any window into a scratchpad on the fly, and automatically resizing a scratchpad to fit the current monitor see tdrop-gitAUR.

Different monitor conifgurations for different machines

Since the bspwmrc is a shell script, it allows you to do things like these:

#! /bin/sh

 if [[ $(hostname) == 'myhost' ]]; then
     bspc monitor eDP1 -d I II III IV V VI VII VIII IX X
 elif [[ $(hostname) == 'otherhost' ]]; then
     bspc monitor VGA-0 -d I II III IV V
     bspc monitor VGA-1 -d VI VII VIII IX X
 elif [[ $(hostname) == 'yetanotherhost' ]]; then
     bspc monitor DVI-I-3 -d VI VII VIII IX X
     bspc monitor DVI-I-2 -d I II III IV V


Help! I get a blank screen and my keybindings don't work!

There are a few ways to debug this. First, a blank screen is good. That means bspwm is running.

I would confirm that your xinitrc looks something like

sxhkd &
exec bspwm

The ampersand is important. Next, try spawning a terminal in your xinitrc to see if its getting positioned properly. It should appear somewhat "centered" on the screen. To do this, use this .xinitrc:

sxhkd &
urxvt &
exec bspwm

If nothing shows up, that means you probably forgot to install urxvt. If it shows up but isn't centered or taking up most of your screen, that means BSPWM isn't getting started properly. Make sure that you've chmod +x ~/.config/bspwm/bspwmrc .

Next, type pidof sxhkd in that terminal you spawned. It should return a number. If it doesn't, that means sxhd isn't running. Try to be explicit and run sxhkd -c ~/.config/sxhkd/sxhkdrc . You could also try changing the Super key to something like Alt in your sxhkdrc and see if that helps. Another common problem is copying the text from the example files instead of physically copying the file over. Copying / pasting code usually leads to indentation issues which sxhkd can be sensitive to.

Window box larger than the actual application!

This can happen if you are using GTK3 apps and usually for dialog windows. The fix is to create or add the below to a gtk3 theme file (~/.config/gtk-3.0/gtk.css).

.window-frame, .window-frame:backdrop {
  box-shadow: 0 0 0 black;
  border-style: none;
  margin: 0;
  border-radius: 0;
.titlebar {
  border-radius: 0;

(source: Bspwm forum thread)

Problems with Java applications

If you have problems, like Java application Windows not resizing, or menus immediately closing after you click, see Java#Applications not resizing with WM, menus immediately closing.

Problems with keybindings using fish

If you use fish, you will find that you are unable to switch desktops. This is because bspc's use of the ^ character is incompatible with fish. You can fix this by explicitly telling sxhkd to use bash to execute commands:

$ set -U SXHKD_SHELL /usr/bin/bash

Alternatively, the ^ character may be escaped with a backslash in your sxhkdrc file.

See also