{"id":7533,"date":"2026-02-24T18:19:19","date_gmt":"2026-02-24T18:19:19","guid":{"rendered":"https:\/\/commandlinux.com\/?p=7533"},"modified":"2026-02-24T18:20:21","modified_gmt":"2026-02-24T18:20:21","slug":"bspwm","status":"publish","type":"post","link":"https:\/\/commandlinux.com\/arch-linux\/bspwm\/","title":{"rendered":"bspwm Tiling Window Manager"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <style>\n        @import url('https:\/\/fonts.googleapis.com\/css2?family=Inter:wght@400;600;700&family=JetBrains+Mono&display=swap');\n        \n        code {\n            font-family: 'JetBrains Mono', monospace;\n            background: #f3f4f6;\n            padding: 2px 6px;\n            border-radius: 3px;\n            font-size: 0.9em;\n        }\n        \n        pre {\n            background: #f3f4f6;\n            padding: 15px;\n            border-radius: 5px;\n            overflow-x: auto;\n            margin: 1.5em 0;\n        }\n        \n        pre code {\n            background: none;\n            padding: 0;\n        }\n        \n        table {\n            width: 100%;\n            border-collapse: collapse;\n            margin: 1.5em 0;\n        }\n        \n        table th {\n            background: #f3f4f6;\n            text-align: left;\n            padding: 10px;\n            font-weight: 600;\n        }\n        \n        table td {\n            padding: 10px;\n            border-bottom: 1px solid #e5e7eb;\n        }\n        \n        .note, .warning, .tip {\n            padding: 15px;\n            margin: 1.5em 0;\n            border-radius: 5px;\n        }\n        \n        .note {\n            background: #dbeafe;\n            border-left: 4px solid #3b82f6;\n        }\n        \n        .warning {\n            background: #fee2e2;\n            border-left: 4px solid #ef4444;\n        }\n        \n        .tip {\n            background: #d1fae5;\n            border-left: 4px solid #10b981;\n        }\n        \n.bspwm-container        ul, ol {\n            margin: 1em 0;\n            padding-left: 2em;\n        }\n        \n.bspwm-container        li {\n            margin-bottom: 0.5em;\n        }\n        \n        .faq-section {\n            margin-top: 3em;\n        }\n        \n        .faq-item {\n            margin-bottom: 1em;\n        }\n        \n        .faq-item input[type=\"checkbox\"] {\n            display: none;\n        }\n        \n        .faq-item label {\n            display: block;\n            padding: 15px;\n            background: #f3f4f6;\n            cursor: pointer;\n            border-radius: 5px;\n            transition: background 0.3s;\n        }\n        \n        .faq-item label:hover {\n            background: #e5e7eb;\n        }\n        \n        .faq-item label h3 {\n            margin: 0;\n            font-size: 1.1em;\n        }\n        \n        .faq-answer {\n            max-height: 0;\n            overflow: hidden;\n            transition: max-height 0.3s;\n            padding: 0 15px;\n        }\n        \n        .faq-item input[type=\"checkbox\"]:checked ~ .faq-answer {\n            max-height: 500px;\n            padding: 15px;\n        }\n    <\/style>\n<\/head>\n<body>\n\n<p>bspwm organizes windows as leaves in a binary tree. This tiling window manager runs on X11 systems and handles multiple displays. It partially follows EWMH standards and requires separate programs for keyboard input.<\/p>\n\n<p>The software uses a client-server model. The <code>bspc<\/code> program sends messages to the window manager through a socket. A hotkey daemon like <code>sxhkd<\/code> translates key presses into <code>bspc<\/code> commands.<\/p>\n\n<h2>Features<\/h2>\n\n<p>bspwm represents windows as nodes in a binary tree structure. Each monitor contains desktops, and each desktop points to a tree. The window manager supports EWMH and Xinerama protocols.<\/p>\n\n<p>Configuration happens through shell scripts that call <code>bspc<\/code>. No special syntax exists &#8211; just standard bash commands. This design lets you use any shell tool in your configuration.<\/p>\n\n<h2>Getting Started<\/h2>\n\n<p>Install both <code>bspwm<\/code> and <code>sxhkd<\/code> packages. Most distributions include them in their repositories:<\/p>\n\n<pre><code>$ sudo apt install bspwm sxhkd<\/code><\/pre>\n\n<p>Add this line to <code>~\/.xinitrc<\/code>:<\/p>\n\n<pre><code>exec bspwm<\/code><\/pre>\n\n<p>Run <code>startx<\/code> to launch the window manager. You&#8217;ll see a blank screen &#8211; this is normal.<\/p>\n\n<div class=\"note\">\n  <strong>Note:<\/strong> The blank screen appears because bspwm doesn&#8217;t set wallpapers or handle keyboard shortcuts by default. These require configuration.\n<\/div>\n\n<h2>Setting Up Your Environment<\/h2>\n\n<p>Copy example configs from <code>\/usr\/share\/doc\/bspwm\/examples\/<\/code>. Create the config directories first:<\/p>\n\n<pre><code>$ mkdir -p ~\/.config\/bspwm ~\/.config\/sxhkd\n$ cp \/usr\/share\/doc\/bspwm\/examples\/bspwmrc ~\/.config\/bspwm\/\n$ cp \/usr\/share\/doc\/bspwm\/examples\/sxhkdrc ~\/.config\/sxhkd\/\n$ chmod +x ~\/.config\/bspwm\/bspwmrc<\/code><\/pre>\n\n<h3>Adding a Key Binding Daemon<\/h3>\n\n<p>sxhkd handles keyboard shortcuts. Create <code>~\/.config\/sxhkd\/sxhkdrc<\/code> with these bindings:<\/p>\n\n<pre><code># Terminal\nalt + Return\n  terminator\n\n# Reload sxhkd\nalt + Escape\n  pkill -USR1 -x sxhkd\n\n# Application launcher\nalt + d\n  dmenu_run\n\n# Quit\/restart bspwm\nalt + shift + {q,r}\n  bspc {quit,wm -r}<\/code><\/pre>\n\n<p>Start the daemon in <code>bspwmrc<\/code>:<\/p>\n\n<pre><code>sxhkd &<\/code><\/pre>\n\n<h3>Drawing a Wallpaper<\/h3>\n\n<p>Install <code>nitrogen<\/code> for wallpaper management:<\/p>\n\n<pre><code>$ sudo apt install nitrogen\n$ nitrogen --set-scaled \/path\/to\/image.png<\/code><\/pre>\n\n<p>Add this command to <code>bspwmrc<\/code> to set the wallpaper at startup.<\/p>\n\n<h3>Setting Up a Compositor<\/h3>\n\n<p>Install <code>picom<\/code> for transparency and shadows:<\/p>\n\n<pre><code>$ sudo apt install picom<\/code><\/pre>\n\n<p>Launch it in <code>bspwmrc<\/code>:<\/p>\n\n<pre><code>picom &<\/code><\/pre>\n\n<h3>Adding a Status Bar<\/h3>\n\n<p>Polybar provides system information and workspace indicators. Install it through your package manager or compile from source.<\/p>\n\n<p>Copy a config to <code>~\/.config\/polybar\/config<\/code>. Launch it in <code>bspwmrc<\/code>:<\/p>\n\n<pre><code>pkill polybar\n~\/.config\/polybar\/launch.sh &<\/code><\/pre>\n\n<div class=\"tip\">\n  <strong>Tip:<\/strong> Test polybar configurations with <code>polybar example<\/code> before adding them to your startup script.\n<\/div>\n\n<h2>The bspwm Client<\/h2>\n\n<p>The <code>bspc<\/code> command controls all window manager functions. It sends socket messages to modify layouts, windows, and settings.<\/p>\n\n<h3>Node Actions<\/h3>\n\n<p>Nodes represent windows in the binary tree. Control them with <code>bspc node<\/code> commands:<\/p>\n\n<table>\n  <tr>\n    <th>Command<\/th>\n    <th>Action<\/th>\n  <\/tr>\n  <tr>\n    <td><code>bspc node -c<\/code><\/td>\n    <td>Close window<\/td>\n  <\/tr>\n  <tr>\n    <td><code>bspc node -k<\/code><\/td>\n    <td>Kill window<\/td>\n  <\/tr>\n  <tr>\n    <td><code>bspc node -d 7<\/code><\/td>\n    <td>Send to desktop 7<\/td>\n  <\/tr>\n  <tr>\n    <td><code>bspc node -p north<\/code><\/td>\n    <td>Preselect north<\/td>\n  <\/tr>\n<\/table>\n\n<p>Add these to <code>sxhkdrc<\/code>:<\/p>\n\n<pre><code># Send window to desktop\nalt + shift + {1-9}\n  bspc node -d '^{1-9}'\n\n# Close and kill\nalt + {_,shift + }c\n  bspc node -{c,k}\n\n# Preselect direction\nsuper + ctrl + {h,j,k,l}\n  bspc node -p {west,south,north,east}<\/code><\/pre>\n\n<h3>Window State Actions<\/h3>\n\n<p>Windows exist in four states:<\/p>\n\n<table>\n  <tr>\n    <th>State<\/th>\n    <th>Description<\/th>\n  <\/tr>\n  <tr>\n    <td>Tiled<\/td>\n    <td>Size determined by window tree<\/td>\n  <\/tr>\n  <tr>\n    <td>Floating<\/td>\n    <td>Moves and resizes freely<\/td>\n  <\/tr>\n  <tr>\n    <td>Pseudo-tiled<\/td>\n    <td>Tiled but constrained to floating size<\/td>\n  <\/tr>\n  <tr>\n    <td>Fullscreen<\/td>\n    <td>Fills monitor with no borders<\/td>\n  <\/tr>\n<\/table>\n\n<p>Switch states with keybindings:<\/p>\n\n<pre><code>alt + {t,shift + t,s,f}\n  bspc node -t {tiled,pseudo_tiled,floating,fullscreen}<\/code><\/pre>\n\n<h3>Window Rules<\/h3>\n\n<p>Configure per-application behavior in <code>bspwmrc<\/code>. Find window classes with <code>xprop<\/code>:<\/p>\n\n<pre><code>$ xprop | grep WM_CLASS<\/code><\/pre>\n\n<p>Click the target window. Use the class name in rules:<\/p>\n\n<pre><code>bspc rule -a Firefox desktop='^2' follow=on\nbspc rule -a Gimp desktop='^8' state=floating<\/code><\/pre>\n\n<div class=\"warning\">\n  <strong>Warning:<\/strong> Window class names are case-sensitive. Verify exact names with <code>xprop<\/code> before adding rules.\n<\/div>\n\n<h2>Layouts<\/h2>\n\n<p>bspwm offers multiple layout modes that determine how windows split and arrange.<\/p>\n\n<h3>Automatic Layout<\/h3>\n\n<p>The default mode splits windows into a binary tree. Each spawn creates two child nodes from the focused window.<\/p>\n\n<h3>Manual Layout<\/h3>\n\n<p>Preselect where the next window appears. Use <code>bspc node -p<\/code> to choose a direction:<\/p>\n\n<pre><code>$ bspc node -p north<\/code><\/pre>\n\n<p>The next window spawns in that location.<\/p>\n\n<h3>Longest Side Layout<\/h3>\n\n<p>Windows split along their longest dimension. Wide windows split vertically, tall ones split horizontally.<\/p>\n\n<p>Configure in <code>bspwmrc<\/code>:<\/p>\n\n<pre><code>bspc config automatic_scheme longest_side<\/code><\/pre>\n\n<h3>Spiral Layout<\/h3>\n\n<p>Windows arrange in a spiral pattern. Each new window takes the space of the insertion point and rotates the tree.<\/p>\n\n<pre><code>bspc config automatic_scheme spiral<\/code><\/pre>\n\n<h3>Polarity<\/h3>\n\n<p>Polarity determines which child node gets split for new windows.<\/p>\n\n<h4>First Child Polarity<\/h4>\n\n<p>Splits the first child node. This is the default behavior.<\/p>\n\n<pre><code>bspc config initial_polarity first_child<\/code><\/pre>\n\n<h4>Second Child Polarity<\/h4>\n\n<p>Splits the second child instead:<\/p>\n\n<pre><code>bspc config initial_polarity second_child<\/code><\/pre>\n\n<h3>Configuring Layout Keybindings<\/h3>\n\n<p>Create a script to switch layouts with notifications. Save to <code>~\/.config\/bspwm\/layout.sh<\/code>:<\/p>\n\n<pre><code>#!\/bin\/bash\nbspc config automatic_scheme $1\nnotify-send \"Layout: $1\"<\/code><\/pre>\n\n<p>Make it executable and add to <code>sxhkdrc<\/code>:<\/p>\n\n<pre><code>alt + ctrl + {1,2,3}\n  ~\/.config\/bspwm\/layout.sh {longest_side,spiral,first_child}<\/code><\/pre>\n\n<h2>Working with Multiple Displays<\/h2>\n\n<p>List connected displays:<\/p>\n\n<pre><code>$ xrandr -q\n$ bspc query -M --names<\/code><\/pre>\n\n<p>Assign workspaces to monitors in <code>bspwmrc<\/code>:<\/p>\n\n<pre><code>bspc monitor DVI-I-1 -d I II III IV\nbspc monitor DVI-I-2 -d V VI VII\nbspc monitor DP-1 -d VIII IX X<\/code><\/pre>\n\n<p>Set display order explicitly:<\/p>\n\n<pre><code>bspc wm -O DVI-I-1 DVI-I-2 DP-1<\/code><\/pre>\n\n<div class=\"note\">\n  <strong>Note:<\/strong> Escape special characters in monitor names with percent signs.\n<\/div>\n\n<h2>Common Issues<\/h2>\n\n<p>Configuration requires time and experimentation. Documentation exists but remains scattered across wikis and forums.<\/p>\n\n<p>sxhkd breaks with fish shell due to the <code>^<\/code> character. Set a different shell:<\/p>\n\n<pre><code>$ export SXHKD_SHELL=\/bin\/sh<\/code><\/pre>\n\n<p>Java applications sometimes misbehave. Add this to <code>bspwmrc<\/code>:<\/p>\n\n<pre><code>wmname LG3D<\/code><\/pre>\n\n<p>GTK3 windows may display incorrectly. Edit <code>~\/.config\/gtk-3.0\/gtk.css<\/code>:<\/p>\n\n<pre><code>.window-frame {\n  box-shadow: 0 0 0 black;\n  border-style: none;\n  margin: 0;\n  border-radius: 0;\n}<\/code><\/pre>\n\n<h2>Getting Help<\/h2>\n\n<p>Check the manual pages for detailed options:<\/p>\n\n<pre><code>$ man bspwm\n$ man bspc\n$ man sxhkd<\/code><\/pre>\n\n<p>The GitHub repository contains examples and documentation. IRC and Matrix channels provide community support.<\/p>\n\n<div class=\"faq-section\">\n  <h2>FAQs<\/h2>\n  \n  <div class=\"faq-item\">\n    <input type=\"checkbox\" id=\"faq1\">\n    <label for=\"faq1\"><h3>What packages does bspwm require?<\/h3><\/label>\n    <div class=\"faq-answer\">\n      <p>Install both <code>bspwm<\/code> and <code>sxhkd<\/code>. The hotkey daemon handles keyboard input since bspwm doesn&#8217;t process keys directly.<\/p>\n    <\/div>\n  <\/div>\n  \n  <div class=\"faq-item\">\n    <input type=\"checkbox\" id=\"faq2\">\n    <label for=\"faq2\"><h3>How do I configure bspwm keybindings?<\/h3><\/label>\n    <div class=\"faq-answer\">\n      <p>Edit <code>~\/.config\/sxhkd\/sxhkdrc<\/code> to add shortcuts. Each binding calls <code>bspc<\/code> commands that control the window manager.<\/p>\n    <\/div>\n  <\/div>\n  \n  <div class=\"faq-item\">\n    <input type=\"checkbox\" id=\"faq3\">\n    <label for=\"faq3\"><h3>Why does bspwm show a blank screen?<\/h3><\/label>\n    <div class=\"faq-answer\">\n      <p>bspwm doesn&#8217;t set wallpapers or configure shortcuts by default. Install <code>nitrogen<\/code> for wallpapers and set up <code>sxhkd<\/code> for keyboard control.<\/p>\n    <\/div>\n  <\/div>\n  \n  <div class=\"faq-item\">\n    <input type=\"checkbox\" id=\"faq4\">\n    <label for=\"faq4\"><h3>Can bspwm handle multiple monitors?<\/h3><\/label>\n    <div class=\"faq-answer\">\n      <p>Yes. Use <code>bspc monitor<\/code> commands to assign workspaces to each display. Set display order with <code>bspc wm -O<\/code>.<\/p>\n    <\/div>\n  <\/div>\n  \n  <div class=\"faq-item\">\n    <input type=\"checkbox\" id=\"faq5\">\n    <label for=\"faq5\"><h3>Which status bars work with bspwm?<\/h3><\/label>\n    <div class=\"faq-answer\">\n      <p>Polybar and lemonbar integrate well. Launch them in <code>bspwmrc<\/code> after killing previous instances to prevent duplicates.<\/p>\n    <\/div>\n  <\/div>\n<\/div>\n\n<\/body>\n<\/html>\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>bspwm organizes windows as leaves in a binary tree. This tiling window manager runs on X11 systems and handles multiple displays. It partially follows EWMH standards and requires separate programs for keyboard input. The software uses a client-server model. The bspc program sends messages to the window manager through a socket. A hotkey daemon like<\/p>\n","protected":false},"author":1,"featured_media":7534,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-7533","post","type-post","status-publish","format-standard","has-post-thumbnail","category-arch-linux"],"_links":{"self":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/7533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/comments?post=7533"}],"version-history":[{"count":2,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/7533\/revisions"}],"predecessor-version":[{"id":7536,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/7533\/revisions\/7536"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/media\/7534"}],"wp:attachment":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/media?parent=7533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/categories?post=7533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/tags?post=7533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}