From ArchWiki
Revision as of 13:22, 13 December 2013 by Baskerville (Talk | contribs) (Rules)

Jump to: navigation, 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 bspwmAUR or bspwm-gitAUR from the AUR. You will also want to install sxhkdAUR or sxhkd-gitAUR, 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 your .xinitrc:

sxhkd &
exec bspwm


Example configuration is found on GitHub.

Copy bspwmrc to ~/.config/bspwm/bspwmrc, sxhkdrc to ~/.config/sxhkd/sxhkdrc and make bspwmrc executable with chmod +x ~/.config/bspwm/bspwmrc.

Documentation for bspwm is found by running man bspwm.

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

These two files are where you will be setting wm settings and keybindings, respectively.

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 floating=on
bspc rule -a Chromium desktop=^2
bspc rule -a mplayer2 floating=on
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. These scripts require lua-posix, lua and xwinfo.

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.


Currently, bar and dzen2 are supported with bspwm. Check the examples folder on the GitHub page for ideas or the Bar wiki page. The panel will be executed by placing panel & for bar or panel dzen2 & for dzen2 in your bspwmrc. Check the opt-depends in the bspwm package for dependencies that may be required in either case.

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 "\f6"$volLevel
                # If it is muted, make the font red
                echo "\f1"$volLevel

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 &


The following environmental variables may need to be defined:


If either of these do not respond with a value, then go to your ~/.profile and add the following lines:

export XDG_CONFIG_HOME="$HOME/.config"
export BSPWM_SOCKET="/tmp/bspwm-socket"
Note: You may put these anywhere that is sourced for your user. Another sane place to put these would be as part of your user's ~/.xinitrc, or zsh users might choose ~/.zshenv. User your best discretion.

See also