How to Install and Configure BSPWM on Arch Linux

How to Install and Configure BSPWM on Arch Linux

BSPWM (Binary Space Partitioning Window Manager) is a minimalist, tiling window manager that follows the binary space partitioning scheme. Unlike traditional stacking or even dynamic tiling WMs like i3, BSPWM treats your screen space as a binary tree and arranges windows accordingly. It doesn’t handle keybindings or status bars directly — instead, it delegates these to other programs like sxhkd and polybar.

For Arch Linux users who value minimalism, flexibility, and control, BSPWM is a great choice. This guide will walk you through installing and configuring BSPWM on Arch Linux, from setting up the basics to creating a fully usable desktop environment.


1. Prerequisites

Before diving into installation, ensure you have the following:

  • A working Arch Linux installation with internet access.
  • Basic knowledge of the terminal and text editors (like nano, vim, or neovim).
  • Access to an existing window manager or desktop environment (optional but helpful for troubleshooting).

Let’s get started.


2. Installing BSPWM and Required Packages

Open a terminal and run the following command to install BSPWM and its hotkey daemon sxhkd:

sudo pacman -S bspwm sxhkd xorg xorg-xinit

We also recommend installing some additional utilities to make your setup more usable:

sudo pacman -S alacritty dmenu rofi feh picom polybar git neovim
  • Alacritty: a GPU-accelerated terminal emulator.
  • Rofi/Dmenu: application launchers.
  • Feh: sets the wallpaper.
  • Picom: compositor for transparency and shadows.
  • Polybar: customizable status bar.

3. Setting Up sxhkd for Keybindings

BSPWM itself doesn’t handle keyboard input — that’s the job of sxhkd.

Create the necessary directories:

mkdir -p ~/.config/bspwm ~/.config/sxhkd

Copy the example configuration files provided by BSPWM:

cp /usr/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm/bspwmrc
cp /usr/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd/sxhkdrc

Make sure the bspwmrc script is executable:

chmod +x ~/.config/bspwm/bspwmrc

At this point, you have a basic BSPWM setup ready to go.


4. Creating a Basic Configuration

Let’s edit the bspwmrc file and ensure it launches everything we need:

nvim ~/.config/bspwm/bspwmrc

Here’s a simple example:

#!/bin/sh

# Start sxhkd
sxhkd &

# Set wallpaper
feh --bg-scale ~/Pictures/wallpaper.jpg &

# Start compositor
picom &

# Start panel
~/.config/polybar/launch.sh &

# Set window rules
bspc config border_width         2
bspc config window_gap           10
bspc config split_ratio          0.5
bspc config borderless_monocle   true
bspc config gapless_monocle      true

Adjust the wallpaper path accordingly.


5. Autostarting Applications

To launch programs on startup, just append them to your bspwmrc. Here’s how you might launch Alacritty on startup:

alacritty &

Or maybe you want your network manager applet and volume control GUI:

nm-applet &
volumeicon &

6. Setting Up a Status Bar (Polybar)

6.1 Install and Configure Polybar

If you haven’t installed it yet:

sudo pacman -S polybar

Create a configuration directory:

mkdir -p ~/.config/polybar

Clone a sample config:

git clone https://github.com/polybar/polybar ~/.config/polybar

Or create a simple launcher script ~/.config/polybar/launch.sh:

#!/bin/bash

killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done

polybar example &

Make it executable:

chmod +x ~/.config/polybar/launch.sh

6.2 Customize ~/.config/polybar/config.ini

You can configure modules for workspace switching, network, CPU, memory, time, etc.


7. Setting a Wallpaper and Compositor

Use Feh to set a wallpaper:

feh --bg-scale ~/Pictures/wallpaper.jpg

Add this to bspwmrc so it persists.

Install and run Picom for transparency and shadow effects:

picom --config ~/.config/picom/picom.conf &

You can copy the default configuration as a base:

mkdir -p ~/.config/picom
cp /etc/xdg/picom.conf ~/.config/picom/picom.conf

Edit it to enable shadows, transparency, vsync, etc.


8. Enabling BSPWM from a Display Manager or Startx

Option 1: Using .xinitrc

Edit (or create) ~/.xinitrc:

exec bspwm

Then launch it with:

startx

Option 2: Using a Display Manager

If you’re using LightDM, GDM, or another DM:

  1. Create a session file:
    /usr/share/xsessions/bspwm.desktop
[Desktop Entry]
Name=BSPWM
Comment=Binary Space Partitioning Window Manager
Exec=bspwm
Type=Application

Then choose BSPWM from the login screen.


9. Tips for Customization

Customizing Keybindings

Edit ~/.config/sxhkd/sxhkdrc to define your keyboard shortcuts.

Example:

# Open terminal
super + Return
    alacritty

# Close window
super + q
    bspc node -c

# Reload config
super + Escape
    bspc wm -r

Workspaces (Desktops)

By default, BSPWM supports multiple desktops per monitor. Example bindings:

# Switch to desktop 1
super + {1-9}
    bspc desktop -f ^{1-9}

# Move focused window to desktop
super + shift + {1-9}
    bspc node -d ^{1-9}

Floating Windows

To toggle a window into floating mode:

bspc node -t floating

You can assign rules for floating apps in your bspwmrc:

bspc rule -a Gimp state=floating
bspc rule -a "Firefox" desktop='^2' follow=on

10. Conclusion

Installing and configuring BSPWM on Arch Linux opens the door to a minimalist and highly efficient workspace. With its unique binary tiling layout, it’s a refreshing alternative to traditional window managers and even other tiling WMs.

While it may take some time to set up everything to your liking — especially compared to full desktop environments like GNOME or KDE — the result is a highly tailored system that can significantly boost productivity, especially for keyboard-centric users.

Once you’ve mastered the basics, you can delve deeper into:

  • Scripting window behaviors
  • Integrating with dunst for notifications
  • Creating custom widgets for Polybar
  • Using tools like xdo or xdotool for automation

BSPWM, in essence, gives you the building blocks — and leaves the rest entirely in your hands.