diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2022-12-28 12:54:27 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-12-29 09:32:58 +0100 |
commit | 9b04e31eac7d8803a2d9121fde8610ac8336e644 (patch) | |
tree | 00e0247fd13f08a5211bd9eb89c290dd0b50df6e /sxhkd/scripts | |
parent | 980d573d64eda82eacef8eaa3d876e488a2a242b (diff) |
bspwm: Update the script to rename desktop
Diffstat (limited to 'sxhkd/scripts')
-rwxr-xr-x | sxhkd/scripts/sxhkd/rofi_rename.sh | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sxhkd/scripts/sxhkd/rofi_rename.sh b/sxhkd/scripts/sxhkd/rofi_rename.sh index 15183b7..65ef9a4 100755 --- a/sxhkd/scripts/sxhkd/rofi_rename.sh +++ b/sxhkd/scripts/sxhkd/rofi_rename.sh @@ -3,10 +3,16 @@ /bin/echo -en "\0prompt\x1fRenomer\n" if [ -z $1 ]; then - echo "edit" - echo "musique" + bspc query --desktops --names exit 0 else - bspc desktop -n ${1} + desktop=$(bspc query --desktops --names | grep "$1") + + # If the required desktop does not exists, rename it + if [ -z "$desktop" ]; then + bspc desktop -n ${1} + else + bspc desktop --focus "${desktop:-$1}" + fi exit 1 fi |