#!/bin/sh

# adapted from dmenu_path in the original dmenu distribution
cachedir=${XDG_CACHE_HOME:-$HOME/.cache}
if [ -d "$cachedir" ]; then
	cache=$cachedir/dmenu2_run
else
	cache=$HOME/.dmenu2_cache # if no xdg dir, fall back to dotfile in ~
fi
IFS=:
if stest2 -dqr -n "$cache" $PATH; then
	stest2 -flx $PATH | sort -u | tee "$cache"
else
	cat "$cache"
fi
