Last active
January 24, 2021 16:57
-
-
Save mdynnl/f4290f8d59b68de6fd952b4cb1c7f843 to your computer and use it in GitHub Desktop.
bspwm, sxhkd: pin a node to (a) desktop(s)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ROOT=/tmp/work | |
| mkdir -p $ROOT | |
| cd $ROOT | |
| clean(){ | |
| ls . | while read n | |
| do bspc node $n -g sticky=off -g hidden=off | |
| done | |
| rm -rf $ROOT | |
| } | |
| trap exit INT KILL TERM ERR | |
| trap clean EXIT | |
| bspc subscribe desktop_focus | while read _ _ d | |
| do | |
| ls . | while read n | |
| do if [ -e $n/$d ] | |
| then echo show $n $d; bspc node $n -g sticky=on -g hidden=off | |
| else echo hide $n $d; bspc node $n -g sticky=on -g hidden=on | |
| fi | |
| done | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| super + ctrl + shift + {1-9,0} | |
| n=$(bspc query -N -n); \ | |
| d=$(bspc query -D -d '^{1-9,10}'); \ | |
| p=/tmp/work/$n; \ | |
| f=$p/$d; \ | |
| if [ -e $f ]; then \ | |
| rm $f; \ | |
| rmdir --ignore-fail-on-non-empty $p; \ | |
| bspc node $n -g hidden=off -g sticky=off -d $(bspc query -D -d); \ | |
| else install -D /dev/null $f; \ | |
| bspc node $n -g sticky=on; \ | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment