Hacker News new | past | comments | ask | show | jobs | submit login
bspwm: tiling window manager that represents windows as leaves of a binary tree (github.com/baskerville)
121 points by j-james 6 months ago | hide | past | favorite | 31 comments



My favorite WM! I've been using it for years now, after trying i3, herbstluft, xmonad, qtile and a bunch of others.

It's very lightweight and highly customizable. The configuration file is just a shell script of bspc (client) commands. It doesn't handle keybindings on its own, but leverages another awesome tool by the same author: https://github.com/baskerville/sxhkd Which also simply calls bspc, but can be used for generic hotkeys as well.

It's just an awesomely simple pair of tools that work great, stay out of my way, are rock solid and well maintained. Pure gems of the open source world. Please consider donating to support the author: https://github.com/baskerville/bspwm/blob/master/doc/CONTRIB... (I have no affiliation, just a very happy user.)

This WM is the only thing besides habit keeping me from switching to Wayland. Though I guess I could get used to Sway.


A great aspect of bspwm is that it is relatively unopinionated about how it is configured and controlled. You can easily invoke bspc from any language of your choosing. No need to be limited by an inexpressive configuration file. No need to write the configuration in one specific language that the developer favoured.

Another feature I appreciate is that it does not bind any keys. It is left up to the user to implement. I get to choose which keys are used, and what they do. I wish all programs I used allowed me to configure their key bindings like this.

bspwm is less of a window manager in the traditional sense, and more of a tool that can be used to build your own window manager.


Absolutely this. I'll highlight two sub-commands of bspc that are particularly helpful for "building your own window manager" as you mention: You can dump the entire state of bspwm to JSON using `bspc wm -d`, and you can subscribe to window manager events using `bspc subscribe`.

An example I've implemented for myself: When opening a single app in an empty workspace, by default bspwm stretches the window to fit the whole screen (as usual with tiling window managers). On big monitors, this can be pretty annoying (e.g. staring at the very upper left corner of your 32" monitor when using a terminal). Using bspc, I can listen to when new windows are added, inspect bspwm's state to see if the new window is in a workspace on its own, and then use bspc to adjust the margins on the workspace to make the window a more comfortable size in the center of the screen. Even in Python I can do this in ~100ms.


That particular example sounds more complicated than it is to apply dwm’s alwayscentered patch, yank-put the Gimp isfloating example line in the default config.g, and s/Gimp/terminal/ (which doesn’t actually require truly grokking C).


Or XMonad's layout processing pipeline.

But it's a nice trick and I will fully admit it :)


I never understood why its a big deal that windows are leaves of a binary tree? Its that good? Not trying to be snarky, just curious.


Same here. What's problem does this solve? Or, is this just a neat proof-of-concept project? This isn't a loaded question, I'm genuinely curious.


Navigation of the windows to which one is focused is no longer keyboard driven. Many just move the window into the largest leaf, and rotate the rest.

Focus will still follow your mouse I believe.

The binary tree concept just is a way of sorting the windows such that the rotation is predictable regardless of tiling layout.


ahh cool thanks.


I recommend https://herbstluftwm.org/

It's similar to bspwm.

- Both are controlled over a socket by a client program. Anything you can do to windows with a mouse or keyboard you can do with a script, and vice versa.

- The configuration for both is an rc file that's executed.

- Both are dynamic tiling managers, with a binary tree of containers.

- Both compare well to i3 by limiting the container tree to a binary tree, and eliminating keybindings to change container focus or move containers.

For examples of various window managers and accessories https://www.reddit.com/r/unixporn/


The Dynamic Window Manager can also be controlled by a client program (which you can call from a file, which you can make execute from your ~/.xinitrc) with this patch (which I don’t use, but it looks like it can do most keyboard things but no mouse actions): http://dwm.suckless.org/patches/dwmc/


dwm and i3 are too capable and too complex. I get lost in the nested containers


> I get lost in the nested containers

I don’t think dwm has them, they seem like a manual tiling thing.


My main reason for using bspwm over herbstluftwm was that I had issues doing certain operations between two monitors, such as dragging a window in floating mode between two monitors.


If anyone wants to learn more about bspwm, such as what it looks like and how it works there's a super in depth video demo of it at: https://www.youtube.com/watch?v=CAkZLFF8kP0

I'm not the author of the video. I just remember watching this about a year ago and thinking it was the best resource I found to see what bspwm can do and how to use it. Highly recommend it (and watching it at 2x speed).


I've been a BSPWM user for about 5 years now.

It's very comfy. The client is close to the shell, and you can have both automatic and manual tiling modes. When there is some feature you like that the author did not account for, you can query the state of the world in json and make decisions based on that.

A comment here mentions herbstluftwm, which came before BSPWM and I would even call a sister WM -- Baskerville even announced BSPWM on the Herbstluftwm mailing list when it was initially released[2]. I would say BSPWM has less to think about than in the other window manager (everything is a node vs climbing frames with nested layouts). It can be thought of as a kit for building what you want, even. For instance, I use a tag-based workflow[3], where I toggle the hidden flag of nodes, and keep only one desktop.

WRT the windows being kept as nodes in a binary tree, this is useful because you can then climb the tree and perform balances and rotations within a subselection of the whole thing. You can also use the tree datastructure to enforce layout, like here[1], a DWM-like stacking layout.

With monocle mode, you can add fake padding for fullscreen windows, allowing you to have comfy fullscreen stuff that still accounts for a panel presence. With an external rules script, you can make decisions about what to do with windows as they appear, allowing dynamic layouts and decision making.

I'm sure at the end of the day, you can get what you need with any window manager if you drill far enough (year of the linux desktop is here, if you are willing to read the source). BSPWM has been a nice base for flexible workflow types for me. I will also share screenshots I've taken over the years here: https://notes.neeasade.net/rice.html (all bspwm past mid 2014).

[1] https://old.reddit.com/r/bspwm/comments/euq5r7/a_dwmlike_sta...

[2] https://herbstluftwm.org/archive/msg00052.html

[3] https://github.com/neeasade/dotfiles/blob/master/bin/bin/bta...


I’m curious: after about four things the windows seem to start getting really small. Does anyone really find much use in a window manager that can subdivide infinitely?


1) You need to do something when many windows are open. Making windows small is predictable and lets the user position the windows "correctly".

Possible "correct" positions I can think of is: move a window to a different workspace (so not all are visible at the same time). Make a window floating (I often have a small terminal open that I shove into deadspace of another window).

2) It can serve as a selection pane. Half of the screen is devoted to the current window, While the other half (possibly sized to take up less than half the screen) is storing a bunch of windows to be swapped in for the current one.


I use bspwm daily and the benefit is that you get a predictable behavior when you launch a new terminal or w/e, which is especially nice when you navigate almost entirely by keyboard; you know where the window will spawn.


Just because you can does not mean you should. You are responsible to arrange your workspaces in a usable manner yourself. I personally make use of i3's (also a tiling WM) tabbed mode where I can make a stack of windows occupy the same area with a list of windows above it, much like tabs in a web browser. Tabbed mode is useful for when I open a bunch of programs that I don't want to close, but don't need to see all at the same time either.


That may look small on a single laptop screen, but on a ultrawide/4k/multihead display it looks great. The ability to choose lets me take advantage of my hardware. (I'm looking at you, macOS, and your 2 window split limit!)


This and i3 on the front page right now, is there some reason hn is exited about tiling wms today?


12/16 is tiling WM day.

(Let’s do this.)


Isn't this what XMonad also does with their Zipper?


In my experience XMonad typically can do anything any other tiling WM can do, but the high barrier of needing to know Haskell before being able to do the most basic of configuration keeps most people from finding that out.

Oh, and it wasn’t stable for me. That might be related to the prior comment, since I really don’t know Haskell at all.


I learned Haskell due to Xmonad. That was probably twelve years ago.

Later I switched to i3 but kept using Haskell.

Even later, I mostly use Macs with a smattering of Debian with vanilla GNOME, so no Xmonad or any other tiling window manager. Still use Haskell.


Zipper is a bit more flexible due to not matching position in data structure with position on screen.

Thus it's really easy to have layouts like accordion or other partially overlapping tiles, or having one big window in middle and the rest in circles around, or just adding a bit of flex based on preserving proportions.


I stuck with bspwm due to the way config is handled. You just but bash commands in bspwmrc, which runs the bspc commands that does the actual configuration on start. bspwm+sxhkd+polybar is my prefered setup.


This is single handedly the greatest increaser of my productivity.


How does it compare to other tiling window managers? What are the unique features you would say you like the most?


I love bspwm!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: