summaryrefslogtreecommitdiff
path: root/desktop/dmenu/dmenu_path
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/dmenu/dmenu_path')
-rw-r--r--desktop/dmenu/dmenu_path26
1 files changed, 26 insertions, 0 deletions
diff --git a/desktop/dmenu/dmenu_path b/desktop/dmenu/dmenu_path
new file mode 100644
index 0000000000..7896a9e957
--- /dev/null
+++ b/desktop/dmenu/dmenu_path
@@ -0,0 +1,26 @@
+#!/bin/sh
+CACHE=$HOME/.dmenu_cache
+IFS=:
+
+uptodate() {
+ test -f "$CACHE" &&
+ for dir in $PATH
+ do
+ test ! $dir -nt "$CACHE" || return 1
+ done
+}
+
+if ! uptodate
+then
+ for dir in $PATH
+ do
+ cd "$dir" &&
+ for file in *
+ do
+ test -x "$file" && echo "$file"
+ done
+ done | sort | uniq > "$CACHE".$$ &&
+ mv "$CACHE".$$ "$CACHE"
+fi
+
+cat "$CACHE"