aboutsummaryrefslogtreecommitdiff
path: root/dmenu_run
diff options
context:
space:
mode:
Diffstat (limited to 'dmenu_run')
-rwxr-xr-xdmenu_run17
1 files changed, 10 insertions, 7 deletions
diff --git a/dmenu_run b/dmenu_run
index e0a3e13..052e51b 100755
--- a/dmenu_run
+++ b/dmenu_run
@@ -1,12 +1,15 @@
1#!/bin/sh 1#!/bin/sh
2CACHE=${XDG_CACHE_HOME:-"$HOME/.cache"}/dmenu_run 2cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
3if [ ! -d "`dirname "$CACHE"`" ]; then 3if [ -d "$cachedir" ]; then
4 CACHE=$HOME/.dmenu_cache 4 cache=$cachedir/dmenu_run
5else
6 cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
5fi 7fi
6( 8(
7 IFS=: 9 IFS=:
8 if stest -dqr -n "$CACHE" $PATH; then 10 if stest -dqr -n "$cache" $PATH; then
9 stest -flx $PATH | sort -u > "$CACHE" 11 stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@"
12 else
13 dmenu "$@" < "$cache"
10 fi 14 fi
11) 15) | ${SHELL:-"/bin/sh"} &
12cmd=`dmenu "$@" < "$CACHE"` && exec sh -c "$cmd"