faster dmenu_run -f
This commit is contained in:
parent
8ac44eb75a
commit
a02a1a6623
2 changed files with 11 additions and 8 deletions
2
dmenu.c
2
dmenu.c
|
@ -117,7 +117,7 @@ main(int argc, char *argv[]) {
|
||||||
setup();
|
setup();
|
||||||
run();
|
run();
|
||||||
|
|
||||||
return EXIT_FAILURE; /* unreachable */
|
return 1; /* unreachable */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
17
dmenu_run
17
dmenu_run
|
@ -1,12 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
CACHE=${XDG_CACHE_HOME:-"$HOME/.cache"}/dmenu_run
|
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
|
||||||
if [ ! -d "`dirname "$CACHE"`" ]; then
|
if [ -d "$cachedir" ]; then
|
||||||
CACHE=$HOME/.dmenu_cache
|
cache=$cachedir/dmenu_run
|
||||||
|
else
|
||||||
|
cache=$HOME/.dmenu_cache
|
||||||
fi
|
fi
|
||||||
(
|
(
|
||||||
IFS=:
|
IFS=:
|
||||||
if [ "`ls -dt $PATH "$CACHE" | head -n 1`" != "$CACHE" ]; then
|
if [ "`ls -dt $PATH "$cache" | head -n 1`" != "$cache" ]; then
|
||||||
lsx $PATH | sort -u > "$CACHE"
|
lsx $PATH | sort -u | tee "$cache" | dmenu "$@"
|
||||||
|
else
|
||||||
|
dmenu "$@" < "$cache"
|
||||||
fi
|
fi
|
||||||
)
|
) | read cmd && exec sh -c "$cmd"
|
||||||
cmd=`dmenu "$@" < "$CACHE"` && exec sh -c "$cmd"
|
|
||||||
|
|
Loading…
Reference in a new issue