From 83ee31d1a5a78c8e5c5f4c0b9887c6eed7e8bd14 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 25 Oct 2022 13:58:53 -0400 Subject: [PATCH] sxhkd: Add desktop bouncing functionality Note that I originally used this as a test to see how useful it would be, however I quickly realized that having unpredictable desktop states is not ideal, especially when not using a status bar like polybar. The code was shared as a solution to a post on r/bspwm. Credits to the original author, however I plan to ditch this solution for more predictable desktop management. --- sxhkd/.config/sxhkd/sxhkdrc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc index fde807f8..d78a10b4 100644 --- a/sxhkd/.config/sxhkd/sxhkdrc +++ b/sxhkd/.config/sxhkd/sxhkdrc @@ -74,9 +74,17 @@ super + ctrl + {1-9} # ======= Desktop ======= # ======================= -# Focus a certain desktop / Send a node to a certain desktop -super + {_,shift} + {1-9,0} - bspc {desktop -f,node -d} '^{1-9,10}' +# Focus desktop {1-9,0} (or bounce to last desktop) +super + {1-9,0} + target='^{1-9,10}'; \ + [ "$(bspc query -D -d "$target")" != "$(bspc query -D -d)" ] \ + && bspc desktop -f "$target" || bspc desktop -f last.local + +# Send a node to a certain desktop (or bounce to the last one) +super + shift + {1-9,0} + target='^{1-9,10}'; \ + [ "$(bspc query -D -d "$target")" != "$(bspc query -D -d)" ] \ + && bspc node -d "$target" || bspc node -d last.local # Move to the next desktop on the current monitor super + {_, shift} + Tab