aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sway/.local/bin/wmenu-run
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-05-28 15:27:15 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-05-28 15:27:15 -0500
commitdd6cfb63ad85d0164cbe4ac04f7aea9f6a842f02 (patch)
tree5bc45394b9192771bcc85fa59b8aab4b8a4301bb /sway/.local/bin/wmenu-run
parent1527172edf1f7d65095a5c2268947c16ed905d18 (diff)
feat!: remove unused configs and cleanup paths
Diffstat (limited to 'sway/.local/bin/wmenu-run')
-rwxr-xr-xsway/.local/bin/wmenu-run34
1 files changed, 34 insertions, 0 deletions
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