1
0
forked from extern/nix-config

bspwm: Add dynamic desktops implementation

This was my implementation of dynamic desktops, largely inspired by the
various hints I found on r/bspwm. Although this was a very engaging
intellectual exercise, I eventually realized that GNOME handles dynamic
desktops much better, and comes with a slew of other conveniences as
well.
This commit is contained in:
Donovan Glover 2022-12-26 22:33:45 -05:00
parent 60f5353318
commit 2bfb8bb961
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -136,5 +136,24 @@ alttab -d 1 -w 1 -font "xft:Noto Sans CJK JP" -mk Super_L &
# Fix bar showing above fullscreen programs
xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" $(xdo id -n tint2)
# Open new nodes on the next unoccupied desktop (dynamic desktops part 1)
bspc subscribe node_add | while read event; do
if [ $(bspc query -N -n '.local.!hidden.tiled' | wc -l) -gt 1 ]; then
nodeId=$(echo "$event" | cut -d" " -f 5)
next=$(bspc query -D -d 'next.!occupied')
if [ -n "$next" ]; then
bspc node "$nodeId" --to-desktop "$next" --follow
fi
fi
done &
# Go to the previous node if the current desktop is empty (dynamic desktops part 2)
bspc subscribe node_remove | while read event; do
if [ -n "$(bspc query -D -d '.!occupied' | rg $(bspc query -D -d focused))" ]; then
bspc query -N -n older && bspc node older -f || bspc desktop '^1' -f
fi
done &
# Make the start button work as expected
ksuperkey -t 200