Skip to content

Instantly share code, notes, and snippets.

@webstrand
Created January 19, 2017 05:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save webstrand/5403f3f863b2091ca8e8322b8d18cccb to your computer and use it in GitHub Desktop.
Save webstrand/5403f3f863b2091ca8e8322b8d18cccb to your computer and use it in GitHub Desktop.
dmenu_path supporting bash aliases
#!/bin/bash
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
compgen -ac | sort -u | tee "$cache"
else
cat "$cache"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment