aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsxhkd/scripts/sxhkd/rofi_rename.sh12
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