Permalink
Browse files

Stop trying to be clever with cache; use dmenu_path

  • Loading branch information...
1 parent 322eca2 commit c99d55aab1d3d9d1c5bde3c7ee478d22d1448b95 @tlvince committed Mar 16, 2013
Showing with 3 additions and 21 deletions.
  1. +1 −5 doc/dmenu_menu.mkd
  2. +0 −8 doc/dmenu_raise_or_run.mkd
  3. +1 −4 src/dmenu_menu
  4. +1 −4 src/dmenu_raise_or_run
View
6 doc/dmenu_menu.mkd
@@ -4,8 +4,4 @@ A recursive `dmenu` menu.
## Usage
-Assumes `dmenu_path` has been called at least once (to create cache file).
-
-An alternative cache file can be passed at runtime:
-
- $ CACHE="/tmp/my.cache" dmenu_menu
+Filters `$PATH` on commands beginning with `$PREFIX` (`dmenu_` by default).
View
8 doc/dmenu_raise_or_run.mkd
@@ -5,11 +5,3 @@ Raise a command's window if it exists, otherwise run it.
## Dependencies
* `wmctrl`
-*
-## Usage
-
-Assumes `dmenu_path` has been called at least once (to create cache file).
-
-An alternative cache file can be passed at runtime:
-
- $ CACHE="/tmp/my.cache" dmenu_raise_or_run
View
5 src/dmenu_menu
@@ -2,10 +2,7 @@
# A recursive dmenu menu.
# Copyright 2010-2013 Tom Vincent <http://tlvince.com/contact/>
-CACHE="${CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/dmenu_run}"
-[ -f "$CACHE" ] || { CACHE="$HOME/.dmenu_cache" && [ -f "$CACHE" ] || exit 1; }
-
prefix="dmenu_"
-cmd="$(grep "$prefix" "$CACHE" | egrep -v "_menu|_path" | \
+cmd="$(dmenu_path | grep "$prefix" | egrep -v "_menu|_path" | \
sed "s/$prefix//" | dmenu "$@")"
[ "$cmd" ] && "${SHELL:-/bin/sh}" -c "${prefix}$cmd &" &
View
5 src/dmenu_raise_or_run
@@ -2,8 +2,5 @@
# Raise a command's window if it exists, otherwise run it.
# Copyright 2013 Tom Vincent <http://tlvince.com/contact/>
-CACHE="${CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/dmenu_run}"
-[ -f "$CACHE" ] || { CACHE="$HOME/.dmenu_cache" && [ -f "$CACHE" ] || exit 1; }
-
-cmd="$(dmenu "$@" < "$CACHE")"
+cmd="$(dmenu_path | dmenu "$@")"
[ "$cmd" ] && { wmctrl -a "$cmd" || ${SHELL:-"/bin/sh"} -c "$cmd &" & }

0 comments on commit c99d55a

Please sign in to comment.