From 9b04e31eac7d8803a2d9121fde8610ac8336e644 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Wed, 28 Dec 2022 12:54:27 +0100 Subject: bspwm: Update the script to rename desktop --- sxhkd/scripts/sxhkd/rofi_rename.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sxhkd/scripts') 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 -- cgit v1.2.3