bspwm Documentation

repository·master·Indexed 27 days ago

https://github.com/baskerville/bspwm

bspwm is a minimal, modular tiling window manager that manages windows using a binary tree structure. It communicates exclusively via a socket through the bspc utility and does not handle input directly, requiring a third-party program like sxhkd for keyboard and pointer events. The documentation covers configuration via bspwmrc, manual and automatic window insertion modes, and the use of bspc for managing monitors, desktops, nodes, rules, and global settings.

Tokens
3.2K
Snippets
3
Records
27
Agent score
93%

What's inside bspwm

  1. Overview of bspwm Architecture

    master

    bspwm is a tiling window manager that represents windows as leaves of a full binary tree. It operates by responding to X events via a dedicated socket.

    Key Components:

    • bspwm: The window manager core.
    • bspc: The client program used to send messages to the bspwm socket.
    • sxhkd: A recommended third-party tool to map keyboard/pointer events to bspc commands.

    Hierarchy:

    • Monitors: Rectangular areas containing desktops.
    • Desktops: Pointers to a window tree.
    • Trees: A partition of a monitor's rectangle into rectangular regions via internal nodes (splits) and leaf nodes (windows).
  2. Configure bspwm via bspwmrc

    master

    The configuration for bspwm is defined in a shell script located at $XDG_CONFIG_HOME/bspwm/bspwmrc. This script should contain bspc commands to set up your environment.

    When bspwm executes this script, it passes an argument to indicate the execution context:

    • $1 -gt 0: The script is being executed after a restart.
    • $1 -eq 0: The script is being executed for the first time (initial startup).

    Note: bspwm does not handle keyboard or pointer inputs directly. You must use a third-party program like sxhkd to translate input events into bspc invocations.

  3. Install bspwm via package managers

    master

    Official packages for bspwm are available for several Linux distributions and BSD:

    • Arch Linux: bspwm-git (AUR) or bspwm (community)
    • Debian: bspwm package
    • Gentoo Linux: bspwm or bspwm-git (via ebuilds)
    • FreeBSD: Available via Ports
    • Void Linux: Available via documentation/wiki
    • Manjaro Linux: Available via community forums
    • BunsenLabs: Available via community forums
    • Chakra: Available via CCR
    • Exherbo: Available via git
  4. Configure bspwm settings

    master

    Use bspc config <setting> [<value>] to get or set global, monitor, desktop, or node settings.

    Example Global Settings:

    • normal_border_color: Color of the border of an unfocused window (#RRGGBB).
    • active_border_color: Color of the border of a focused window of an unfocused monitor.
    • focused_border_color: Color of the border of a focused window of a focused monitor.
    • window_gap: Size of the gap that separates windows.
    • border_width: Window border width.
    • focus_follows_pointer: Whether focus follows the pointer.
  5. Create window rules with bspc rule

    master

    Use bspc rule --add to define rules for how windows are managed when they appear.

    Syntax: bspc rule --add [class_name][:instance_name[:name]] [options]

    Available Options:

    • monitor=MONITOR_SEL / desktop=DESKTOP_SEL / node=NODE_SEL
    • state=STATE (tiled, floating, etc.)
    • layer=LAYER (below, normal, above)
    • split_dir=DIR (north, west, south, east)
    • (hidden|sticky|private|locked|marked|center|follow|manage|focus|border)=on|off
  6. Manage desktops with bspc desktop

    master

    Use bspc desktop to manipulate desktops. If no selector is provided, the focused desktop is targeted.

    Common Commands:

    • focus [DESKTOP_SEL]: Focus a desktop.
    • activate [DESKTOP_SEL]: Activate a desktop.
    • to-monitor MONITOR_SEL [--follow]: Send desktop to a monitor.
    • layout CYCLE_DIR|monocle|tiled: Set or cycle desktop layout.
    • rename <new_name>: Rename the desktop.
    • remove: Remove the selected desktop.