From dd6cfb63ad85d0164cbe4ac04f7aea9f6a842f02 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Tue, 28 May 2024 15:27:15 -0500 Subject: feat!: remove unused configs and cleanup paths --- sway/.local/bin/wmenu-run | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 sway/.local/bin/wmenu-run (limited to 'sway/.local/bin/wmenu-run') diff --git a/sway/.local/bin/wmenu-run b/sway/.local/bin/wmenu-run new file mode 100755 index 0000000..2cda132 --- /dev/null +++ b/sway/.local/bin/wmenu-run @@ -0,0 +1,34 @@ +#!/bin/sh + +cache_dir="${XDG_CACHE_HOME:-"$HOME/.cache"}" +cache="$cache_dir/wmenu_run" + +uptodate() { + IFS=: + for path in $PATH; do + if test "$path" -nt "$cache"; then + return 1 + fi + done + + return 0 +} + +get_bin() { + IFS=: + for path in $PATH; do + for bin in "$path"/*; do + if [ -x "$bin" ]; then + echo "${bin##*/}" + fi + done + done +} + +[ ! -e "$cache_dir" ] && mkdir -p "$cache_dir" + +if [ ! -e "$cache" ] || ! uptodate; then + get_bin | sort -u | tee "$cache" +else + cat "$cache" +fi -- cgit v1.2.3-70-g09d2