diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2022-08-03 13:48:23 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-08-03 13:48:23 +0200 |
commit | 5bd3881e94015b80bd8f833b6db06be280142fea (patch) | |
tree | ee446a3fb5a6e1293aa481754a5ddf6071d0e93b /sxhkd/scripts | |
parent | 2733a93ee8ad446b144d637ee5acd65e26844681 (diff) |
sxhkd script : search a pattern instead of a exact name
Diffstat (limited to 'sxhkd/scripts')
-rwxr-xr-x | sxhkd/scripts/sxhkd/show.sh | 9 |
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}" |