aboutsummaryrefslogtreecommitdiff
path: root/sxhkd/scripts/sxhkd/rofi_new.sh
blob: a5093cd1787a1e30581e85b134c04782aae9abb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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
    # 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
  ~/scripts/sxhkd/show.sh $1
fi