diff options
Diffstat (limited to 'sxhkd/scripts/sxhkd/rofi_new.sh')
-rwxr-xr-x | sxhkd/scripts/sxhkd/rofi_new.sh | 28 |
1 files changed, 23 insertions, 5 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 |