File: dmenu_run

package info (click to toggle)
suckless-tools 40-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 700 kB
  • sloc: ansic: 2,512; makefile: 465; sh: 104
file content (15 lines) | stat: -rwxr-xr-x 350 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
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 ~
fi
(
	IFS=:
	if stest -dqr -n "$cache" $PATH; then
		stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@"
	else
		dmenu "$@" < "$cache"
	fi
) | ${SHELL:-"/bin/sh"} &