~adnano/wmenu-devel

Add wmenu_run v1 SUPERSEDED

sinanmohd: 1
 Add wmenu_run

 1 files changed, 39 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~adnano/wmenu-devel/patches/39820/mbox | git am -3
Learn more about email & git

[PATCH] Add wmenu_run Export this patch

---

Hi,

i wrote a script to replace dmenu_run,
why?, dmenu_run depends on stest, they will not be available if you're not
running xorg and don't have dmenu installed. the proposed wmenu_run only
uses built in sh commands but if the cache is not prepared dmenu_run will
run about 1.16 +- 0.04 faster than the mentioned script, if it is then
wmenu_run will run 2.54 +- 0.26 faster than dmenu_run, which will be the
most likely situation . though the scale of the gains are very small
the main goal of the script is to get rid of dependence on stest and dmenu

 wmenu_run | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100755 wmenu_run

diff --git a/wmenu_run b/wmenu_run
new file mode 100755
index 0000000..6ca13c6
--- /dev/null
+++ b/wmenu_run
@@ -0,0 +1,39 @@
#!/bin/sh

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

uptodate()
{
	IFS=:
	for path  in $PATH
	do
		test "$path" -nt "$cache" &&
			return 1
	done

	return 0
}

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

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

if [ -f "$cache" ] && uptodate
then
	wmenu "$@" < "$cache" | ${SHELL:-"/bin/sh"} &
else
	get_bin | sort -u | tee "$cache" | wmenu "$@" | ${SHELL:-"/bin/sh"} &
fi
--
2.40.0
Hi, thanks for the patch!

I'm going to hold off on applying this for a while, as the Sway devs are
also interested in solving this problem since they plan to replace dmenu
with wmenu in the default Sway configuration. I'd like to involve them
and make sure that whatever solution we pick works for them.