pinosaur
/
dmenu.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8ac44eb
)
faster dmenu_run -f
author
Connor Lane Smith
<cls@lubutu.com>
Sat, 19 Nov 2011 20:24:07 +0000
(21:24 +0100)
committer
Connor Lane Smith
<cls@lubutu.com>
Sat, 19 Nov 2011 20:24:07 +0000
(21:24 +0100)
dmenu.c
patch
|
blob
|
history
dmenu_run
patch
|
blob
|
history
diff --git
a/dmenu.c
b/dmenu.c
index
99db24e
..
a5af9d5
100644
(file)
--- a/
dmenu.c
+++ b/
dmenu.c
@@
-117,7
+117,7
@@
main(int argc, char *argv[]) {
setup();
run();
setup();
run();
- return
EXIT_FAILURE
; /* unreachable */
+ return
1
; /* unreachable */
}
void
}
void
diff --git
a/dmenu_run
b/dmenu_run
index
2747919
..
cf75b0a
100755
(executable)
--- a/
dmenu_run
+++ b/
dmenu_run
@@
-1,12
+1,15
@@
#!/bin/sh
#!/bin/sh
-CACHE=${XDG_CACHE_HOME:-"$HOME/.cache"}/dmenu_run
-if [ ! -d "`dirname "$CACHE"`" ]; then
- CACHE=$HOME/.dmenu_cache
+cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
+if [ -d "$cachedir" ]; then
+ cache=$cachedir/dmenu_run
+else
+ cache=$HOME/.dmenu_cache
fi
(
IFS=:
fi
(
IFS=:
- if [ "`ls -dt $PATH "$CACHE" | head -n 1`" != "$CACHE" ]; then
- lsx $PATH | sort -u > "$CACHE"
+ if [ "`ls -dt $PATH "$cache" | head -n 1`" != "$cache" ]; then
+ lsx $PATH | sort -u | tee "$cache" | dmenu "$@"
+ else
+ dmenu "$@" < "$cache"
fi
fi
-)
-cmd=`dmenu "$@" < "$CACHE"` && exec sh -c "$cmd"
+) | read cmd && exec sh -c "$cmd"