bspwm

On this page 7

bspwm (binary space partitioning window manager) is a tiling window manager for the X Window System that arranges every window as a leaf of a binary tree, splitting the screen into nested halves. On the Linux desktop, bspwm is known for doing one job only: it manages windows and responds to messages, while keyboard shortcuts, panels and wallpapers are left to separate programs.

This minimalism makes bspwm a favorite of users who build their own environment from small parts, but it also means that a fresh installation shows no bar, no menu and no key bindings until the user configures them.

How binary space partitioning arranges windows

bspwm represents each desktop as a full binary tree in which internal nodes describe a split and leaf nodes hold windows. Every internal node records a split direction (vertical or horizontal) and a split ratio, typically 0.5, so the two children share the parent area in that proportion.

When a new window opens, bspwm chooses the focused leaf, replaces it with an internal node and places the old and new windows as its two children. This is why the layout grows as a spiral of halves, quarters and eighths unless the user changes the insertion rule.

The table below summarizes the insertion schemes that control where new windows go.

SchemeHow the split is chosenResulting layout
Longest sideSplit along the longer edge of the focused windowBalanced, roughly square tiles
AlternateAlternate vertical and horizontal splitsRegular spiral pattern
SpiralRotate the tree on each insertionFibonacci-like spiral
Manual preselectionUser picks a direction before opening the windowExact placement chosen per window
Automatic and manual insertion in bspwm

Because the layout is a tree, operations such as rotating, flipping, balancing and swapping subtrees apply to whole groups of windows at once, which is more expressive than the fixed layouts of many other tilers.

The bspc client and sxhkd key daemon

bspwm is controlled entirely through bspc, a command-line client that sends messages to the window manager over a Unix domain socket. Every action, from focusing a window to changing gaps, is a bspc command, so any script or program can drive the window manager.

Keyboard shortcuts are handled by sxhkd (simple X hotkey daemon), a separate program that maps key chords to shell commands. The configuration is therefore split across a few small files, as shown below.

ComponentRoleUsual location
bspwmManages window placement and the treeStarted by the display manager or xinit
bspwmrcExecutable startup script of bspc commands~/.config/bspwm/bspwmrc
bspcClient that sends commands and queriesCalled from scripts and sxhkd
sxhkdTranslates key chords into commands~/.config/sxhkd/sxhkdrc
PanelShows desktops and status, often polybar or lemonbarStarted from bspwmrc
Components of a typical bspwm setup

The bspwmrc file is an ordinary shell script, so settings such as bspc config window_gap 12 or bspc monitor -d I II III IV are simply commands executed at startup. Window rules, for example floating a dialog by its class name, use bspc rule -a.

The bspc subscribe command streams events such as focus changes and new nodes, which allows panels and custom scripts to react instantly without polling.

bspwm compared with other tiling window managers

bspwm belongs to the family of manual and dynamic tilers alongside i3, dwm, Sway and Hyprland. The main differences lie in the layout model, the configuration method and the display protocol.

The comparison below shows where bspwm sits among its closest neighbors.

Window managerLayout modelConfigurationDisplay protocol
bspwmBinary tree of splitsShell script plus sxhkdX11
i3Tree of containers with tabs and stacksSingle text fileX11
dwmFixed master and stack layoutsC source, recompiledX11
Swayi3-compatible container treei3-style text fileWayland
HyprlandDynamic tiling with animationsOwn text formatWayland
bspwm and related tiling window managers

The key distinction is that bspwm has no built-in key handling or tabbed containers: what i3 offers in one file, bspwm splits into cooperating programs. Users who prefer tabs often choose i3, while those who want a scriptable, purely tree-based model choose bspwm.

Window states, desktops and multi-monitor behavior

Each window in bspwm has a state that decides whether it participates in tiling. A window can be tiled, pseudo-tiled, floating or fullscreen, and it can also carry flags such as sticky, locked or private.

  • Tiled windows fill their leaf area completely.
  • Pseudo-tiled windows keep their preferred size but stay centered within their leaf.
  • Floating windows leave the tree and can be moved freely, which suits dialogs.
  • Fullscreen windows cover the whole monitor while keeping their place in the tree.

Desktops belong to monitors, not to the whole screen, so each output has its own set of desktops, which bspwm detects through RandR. Moving a desktop between monitors is a single bspc command.

Limitations and common setup mistakes

The most important limitation is that bspwm is an X11-only window manager. It does not run as a Wayland compositor, so users who move to Wayland must switch to Sway, Hyprland or a similar project and rebuild their configuration.

Most early problems come from configuration rather than bugs, and the table below lists the typical cases.

SymptomLikely causeFix
Black screen, no shortcutssxhkd not startedLaunch sxhkd from bspwmrc
Settings ignoredbspwmrc not executableSet the executable permission
Java windows blankNon-reparenting window managerSet the AWT non-reparenting variable
Duplicate panels after reloadPanel started again on restartKill old instances before launching
Frequent bspwm problems and their fixes

A plain-language summary

bspwm is a program that arranges windows on a Linux screen automatically. Instead of letting windows overlap like papers on a desk, it cuts the screen in half for each new window, then cuts one half again, and so on, so every window gets its own tile.

It is deliberately small. It does not include shortcuts, menus or a taskbar, so you assemble those pieces yourself. That takes effort at first, but it gives people who like to customize their computer exact control over how it looks and behaves.

An example from practice

A software developer uses a laptop with Arch Linux and an external 27-inch monitor. She wants an editor, a terminal and documentation visible at the same time without dragging windows around all day.

Her bspwmrc defines five desktops per monitor, a window gap of 10 pixels and a rule that makes the password manager float. In sxhkd she binds Super plus arrow keys to preselect a split direction and Super plus Return to open a terminal, so a new terminal appears exactly below the editor in a 60 and 40 percent split.

A small script subscribed to bspc events updates her panel with the current desktop. When she unplugs the monitor, its desktops move to the laptop screen automatically, and the result is a keyboard-driven workspace she can rebuild on a new machine by copying three configuration files.