aboutsummaryrefslogtreecommitdiff
path: root/sxhkd/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'sxhkd/scripts')
-rwxr-xr-xsxhkd/scripts/sxhkd/show.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/sxhkd/scripts/sxhkd/show.sh b/sxhkd/scripts/sxhkd/show.sh
index b87067c..9f89fa1 100755
--- a/sxhkd/scripts/sxhkd/show.sh
+++ b/sxhkd/scripts/sxhkd/show.sh
@@ -1,7 +1,12 @@
#!/bin/sh
+# Check if a desktop match the name
+desktop=$(bspc query --desktops --names | grep "$1")
+
# If the required desktop does not exists, create it
-bspc query --desktops --names | grep --quiet "$1" || bspc monitor --add-desktops "$1"
+if [ -z "$desktop" ]; then
+ bspc monitor --add-desktops "$1"
+fi
# Switch to the desired desktop
-bspc desktop --focus "$1"
+bspc desktop --focus "${desktop:-$1}"