BSPWM is a tiling window manager, with various interesting and unique features that I haven’t seen anywhere else. One of these features is sticky floating windows.
A sticky window, is one that persists on all workspaces all at once. In other words, once you mark a window as ‘sticky’, it will stick to its place even when you switch to another workspace.
This feature works best with floating windows, because a tiled window will behave unpredictably on another workspace with existing tiles.
We can make windows floating and sticky, manually, with the following commands.
# set to floating
bspc node -t floating
# set to sticky
bspc node -g sticky
Obviously, these can be mapped to keys with sxhkd
. But, we can also
define rules, to set these properties automatically with bspc rule
.
These rules work based on the window class and instance names, which
we can retrieve using xprop
. Look for WM_CLASS
and WM_NAME
.
At first glance, it may not seem obvious what this may be used for, so here are a few of the ways that I used it.
MPV
I have an ultrawide monitor, so it works well for me, to send all mpv
windows to a corner of my screen. Moreover, I can freely switch
between workspaces while still keeping the mpv
screen in view. This
can also work with the Firefox Picture-in-Picture window.
Here is the relevant bspwmrc
config:
bspc rule -a mpv \
state=floating sticky=on follow=off focus=on \
rectangle=640x360+2760+1040
bspc rule -a "*:Toolkit:Picture-in-Picture" \
state=floating sticky=on follow=off focus=on \
rectangle=640x360+2760+1040
Onboard
Onboard is an onscreen keyboard. I use it on the desktop for typing words in languages that I don’t know, but sometimes need.
bspc rule -a Onboard state=floating sticky=on
Terminals
There are some terminal based programs, like volume controls or calculators, that this may apply as well.
But, since we don’t want all terminals to open floating and sticky, we need to define our own class when running, and map our rule to this class only.
Here is my sxhkd
definition, for terminal based programs that I intend
to run as sticky/floating.
super + x ; {c,v}
alacritty --class progterm -e {qalc -nocurrencies,pulsemixer}
And the rule in bspwmrc
:
bspc rule -a Alacritty:progterm state=floating sticky=on
Note, that other terminals may use different switches for the class, for example
xterm
is -class
.