diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2022-02-21 10:58:53 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-02-21 10:58:53 +0100 |
commit | 30e771058c7669fe49d57c5fcfb8b96b937136a4 (patch) | |
tree | a28df705c6d82947ab164525b952ff3cc5f0e32d /sxhkd | |
parent | 8ce590c46ce9c80d560c9e1dfc59ad52ba7a652f (diff) |
Removed bashism in sxhkd scripts
Diffstat (limited to 'sxhkd')
-rwxr-xr-x | sxhkd/scripts/sxhkd/rofi_new.sh | 28 | ||||
-rwxr-xr-x | sxhkd/scripts/sxhkd/rofi_rotate.sh | 2 |
2 files changed, 24 insertions, 6 deletions
diff --git a/sxhkd/scripts/sxhkd/rofi_new.sh b/sxhkd/scripts/sxhkd/rofi_new.sh index b1e19d8..a5093cd 100755 --- a/sxhkd/scripts/sxhkd/rofi_new.sh +++ b/sxhkd/scripts/sxhkd/rofi_new.sh @@ -1,9 +1,27 @@ -#!/bin/bash +#!/bin/sh + +tmpdir=$(mktemp -d) + +on_exit() { + rm -r "${tmpdir}" +} + +on_preExit() { + on_exit +} + +trap on_exit EXIT # EXIT = 0 +trap on_preExit HUP INT QUIT TERM STOP PWR # 1 2 3 15 30 + if [ -z $1 ]; then - cat <(echo -e "Chat\nWeb\nMail\nMusique") <(bspc query --names -D) | sort -u + # We are using dash, the process substitution syntax is not allowed + # sort -u <(…) <(…) + # so, we are using pipes for that + mkfifo ${tmpdir}/p1 ${tmpdir}/p2 + echo "Chat\nWeb\nMail\nMusique" > "${tmpdir}/p1" & + bspc query --names -D > "${tmpdir}/p2" & + sort -u "${tmpdir}/p1" "${tmpdir}/p2" else - for desktop in $(echo $1 | tr "," "\n"); do - ~/scripts/sxhkd/show.sh $desktop - done + ~/scripts/sxhkd/show.sh $1 fi diff --git a/sxhkd/scripts/sxhkd/rofi_rotate.sh b/sxhkd/scripts/sxhkd/rofi_rotate.sh index 6438f2a..82ee234 100755 --- a/sxhkd/scripts/sxhkd/rofi_rotate.sh +++ b/sxhkd/scripts/sxhkd/rofi_rotate.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh if [ -z $1 ]; then echo "Horaire" echo "Antihoraire" |