diff options
Diffstat (limited to 'herbstluftwm/.local/bin/run_list.sh')
| -rwxr-xr-x | herbstluftwm/.local/bin/run_list.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/herbstluftwm/.local/bin/run_list.sh b/herbstluftwm/.local/bin/run_list.sh new file mode 100755 index 0000000..463bbaf --- /dev/null +++ b/herbstluftwm/.local/bin/run_list.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +set -eu #o pipefail + +cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} +if [ -d "$cachedir" ]; then + cache=$cachedir/run_list +else + cache=$HOME/.run_list +fi + +#if [ ! -f "$cache" ] || [ $(find "$cache" -mmin +180) = "$cache" ]; then +IFS=':' +if [ ! -f "$cache" ] || [ $(find $PATH -prune -cnewer "$cache" 2>/dev/null |\ + head -c1 | wc -c) -eq 1 ]; then + + find -L $PATH -maxdepth 1 -type f -executable -printf "%f\n" 2>/dev/null |\ + sort -u | tee "$cache" +else + cat "$cache" +fi |
