aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-08-03 13:48:23 +0200
committerSébastien Dailly <sebastien@dailly.me>2022-08-03 13:48:23 +0200
commit5bd3881e94015b80bd8f833b6db06be280142fea (patch)
treeee446a3fb5a6e1293aa481754a5ddf6071d0e93b
parent2733a93ee8ad446b144d637ee5acd65e26844681 (diff)
sxhkd script : search a pattern instead of a exact name
-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}"