Skip to content

Instantly share code, notes, and snippets.

@akhiljalagam
Forked from webstrand/dmenu_path
Created October 24, 2019 11:33
Show Gist options
  • Save akhiljalagam/1cb7e123591aeb1e29a229a4b20223a5 to your computer and use it in GitHub Desktop.
Save akhiljalagam/1cb7e123591aeb1e29a229a4b20223a5 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