diff options
| author | Moritz Meißelbach <arbelzapf@gmail.com> | 2019-11-23 21:09:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-23 21:09:48 +0100 |
| commit | 8aa7fe6f22f022042a12380f7c01668499f871ed (patch) | |
| tree | ee06f3cae0913c4017b1176a15d416c465098bbf | |
| parent | e81161a7900556a563594a051d4fad58733cafb7 (diff) | |
| parent | 30f71a98c2dfcfe6efc755f01ea8ae44bd516f58 (diff) | |
| download | sway-launcher-desktop-8aa7fe6f22f022042a12380f7c01668499f871ed.tar.gz sway-launcher-desktop-8aa7fe6f22f022042a12380f7c01668499f871ed.zip | |
Merge pull request #10 from ahaasler/use-fifo
Use a FIFO to stop the loading animation when finished
| -rwxr-xr-x | sway-launcher-desktop.sh | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sway-launcher-desktop.sh b/sway-launcher-desktop.sh index ff788ba..2441cbe 100755 --- a/sway-launcher-desktop.sh +++ b/sway-launcher-desktop.sh @@ -142,9 +142,9 @@ esac touch "$HIST_FILE" readarray HIST_LINES <"$HIST_FILE" -FZFPIPE=$(mktemp) -PIDFILE=$(mktemp) -trap 'rm "$FZFPIPE" "$PIDFILE"' EXIT INT +FZFPIPE=$(mktemp -u) +mkfifo "$FZFPIPE" +trap 'rm "$FZFPIPE"' EXIT INT # Append Launcher History, removing usage count (printf '%s' "${HIST_LINES[@]#* }" >>"$FZFPIPE") & @@ -173,14 +173,10 @@ entries ${DIRS[@]} >>"$FZFPIPE" ) & COMMAND_STR=$( - ( - tail -n +0 -f "$FZFPIPE" & - echo $! >"$PIDFILE" - ) | - fzf +s -x -d '\034' --nth ..3 --with-nth 3 \ - --preview "$0 describe {1} {2}" \ - --preview-window=up:3:wrap --ansi - (kill -9 "$(<"$PIDFILE")"; exit 0) | tail -n1 + fzf +s -x -d '\034' --nth ..3 --with-nth 3 \ + --preview "$0 describe {1} {2}" \ + --preview-window=up:3:wrap --ansi \ + <"$FZFPIPE" ) || exit 1 [ -z "$COMMAND_STR" ] && exit 1 |
