aboutsummaryrefslogtreecommitdiffstats
path: root/sway-launcher-desktop.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sway-launcher-desktop.sh')
-rwxr-xr-xsway-launcher-desktop.sh18
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