Hacker News new | ask | show | jobs
by kevlar1818 2017 days ago
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.

1 comments

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 :)