# bspwm — Tiling Window Manager Based on Binary Space Partitioning > bspwm is a tiling window manager for X11 that arranges windows using a binary tree structure. It is controlled entirely through messages via bspc, making it fully scriptable and highly customizable. Combined with sxhkd for keybindings, it offers a minimal yet powerful desktop workflow. ## Install Save in your project root: # bspwm — Tiling Window Manager Based on Binary Space Partitioning ## Quick Use ```bash # Install on Ubuntu/Debian sudo apt install bspwm sxhkd # Install on Arch sudo pacman -S bspwm sxhkd # Copy default config files mkdir -p ~/.config/bspwm ~/.config/sxhkd cp /usr/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm/ cp /usr/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd/ chmod +x ~/.config/bspwm/bspwmrc ``` ## Introduction bspwm is a minimalist tiling window manager that represents windows as leaves of a binary tree. Created by Bastien Dejean, it separates window management from input handling — bspwm manages the layout while sxhkd (Simple X Hotkey Daemon) handles keyboard shortcuts. All interaction happens through the `bspc` command, making every aspect of the window manager scriptable from the shell. ## What bspwm Does - Arranges windows in a binary tree layout that splits the screen recursively - Controls all window operations through the `bspc` CLI command - Supports multiple monitors with independent desktops per monitor - Provides tiling, floating, and fullscreen modes per window - Integrates with sxhkd for user-defined keyboard shortcuts ## Architecture Overview bspwm models each desktop as a binary tree where internal nodes represent splits (horizontal or vertical) and leaf nodes represent windows. When a new window opens, it splits the focused leaf. The `bspc` command communicates with bspwm over a Unix socket, sending commands like `bspc node -f west` (focus the window to the left) or `bspc node -s east` (swap with the window to the right). External rules match windows by class or title and assign them to specific desktops or set them as floating. ## Self-Hosting & Configuration - Configure bspwm via `~/.config/bspwm/bspwmrc` — a shell script that runs on startup - Define keybindings in `~/.config/sxhkd/sxhkdrc` using a simple syntax - Set window gaps, border width, and colors with `bspc config` commands - Write window rules with `bspc rule -a ClassName desktop=^3 state=floating` - Use a status bar like polybar or lemonbar, reading bspwm state via `bspc subscribe` ## Key Features - Pure separation of concerns — bspwm handles layout, sxhkd handles input, polybar handles status - Fully scriptable via `bspc` — automate layouts, window placement, and desktop switching from shell scripts - Binary tree layout enables intuitive recursive splitting with manual resize and rotation - Per-window rules for automatic desktop assignment, floating state, and focus behavior - EWMH compliance for compatibility with panels, compositors, and desktop utilities ## Comparison with Similar Tools - **i3** — manual tiling with a built-in IPC and config language; bspwm uses a cleaner separation of concerns via bspc and sxhkd - **dwm** — source-code-configured tiling WM; bspwm is configured via shell scripts without recompilation - **Hyprland** — Wayland-native compositor with animations; bspwm is X11-only but lighter and more scriptable - **Awesome WM** — Lua-configured tiling WM; bspwm is simpler with its shell-based approach ## FAQ **Q: Is bspwm good for beginners to tiling WMs?** A: The learning curve is moderate. Copy the example configs, learn a few bspc commands, and customize incrementally. **Q: Does bspwm work with Wayland?** A: No. bspwm is X11-only. For a similar approach on Wayland, consider Sway or River. **Q: How do I add a status bar?** A: Use polybar or lemonbar. Subscribe to bspwm events with `bspc subscribe` to update the bar dynamically. **Q: Can I use bspwm with a compositor for transparency and shadows?** A: Yes. Pair it with picom (formerly compton) for compositing effects. ## Sources - https://github.com/baskerville/bspwm - https://wiki.archlinux.org/title/bspwm --- Source: https://tokrepo.com/en/workflows/asset-5264d9ef Author: AI Open Source