~adnano/wmenu-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] add wmenu_run script, similar to dmenu_run script

Details
Message ID
<20240310150749.19805-1-sewn@disroot.org>
DKIM signature
pass
Download raw message
Patch: +37 -0
based off the works of sinanmohd, modified to be simpler and better
to read, with shellcheck.

Co-authored-by: sinanmohd <sinan@firemail.cc>
---
 meson.build |  2 ++
 wmenu_run   | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100755 wmenu_run

diff --git a/meson.build b/meson.build
index b9f4ec9..56fe511 100644
--- a/meson.build
+++ b/meson.build
@@ -33,6 +33,8 @@ rt = cc.find_library('rt')
subdir('protocols')
subdir('docs')

install_data('wmenu_run', install_dir: get_option('bindir'))

executable(
	'wmenu',
	files(
diff --git a/wmenu_run b/wmenu_run
new file mode 100755
index 0000000..b243b38
--- /dev/null
+++ b/wmenu_run
@@ -0,0 +1,35 @@
#!/bin/sh

cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}"
cache="$cachedir/wmenu_run"

[ -d "$cachedir" ] || mkdir -p "$cachedir"

uptodate() {
	[ -f "$cache" ] || return 1
	IFS=:
	for path in $PATH; do
		# non-POSIX
		test "$path" -nt "$cache" && return 1
	done
	return 0
}

bins() {
	IFS=:
	for path in $PATH; do
		for bin in "$path"/*; do
			[ -x "$bin" ] && echo "${bin##*/}"
		done
	done
}

path() {
	if uptodate; then
		cat "$cache"
	else
		bins | sort -u | tee "$cache"
	fi
}

path | wmenu "$@" | ${SHELL:-"/bin/sh"} &
-- 
2.44.0
Details
Message ID
<CZW0BGW6GC2N.HGDKNWETWQDU@maolood.com>
In-Reply-To
<20240310150749.19805-1-sewn@disroot.org> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git@git.sr.ht:~adnano/wmenu
   1c6c9c1..b8d626a  master -> master
Reply to thread Export thread (mbox)