-CACHE=$HOME/.dmenu_cache
-UPTODATE=1
-IFS=:
-
-uptodate() { [ $UPTODATE -eq 1 ]; }
-
-if test ! -f $CACHE
-then
- UPTODATE=0
-fi
-
-if uptodate
-then
- for dir in $PATH
- do
- test $dir -nt $CACHE && { UPTODATE=0; break; }
- done
+cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
+if [ -d "$cachedir" ]; then
+ cache=$cachedir/dmenu_run
+else
+ cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~