make tmenu_run faster by having an application name cache
This commit is contained in:
parent
a22c5fa20c
commit
38a242c999
1
Makefile
1
Makefile
|
@ -36,6 +36,7 @@ sh:
|
||||||
cp -f sh/git-credential-gitpass $(DESTDIR)$(PREFIX)/bin
|
cp -f sh/git-credential-gitpass $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f sh/capture $(DESTDIR)$(PREFIX)/bin
|
cp -f sh/capture $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f sh/toggle-contingency-mode $(DESTDIR)$(PREFIX)/bin
|
cp -f sh/toggle-contingency-mode $(DESTDIR)$(PREFIX)/bin
|
||||||
|
ln -sf $(DESTDIR)$(PREFIX)/bin/tmenu_run $(DESTDIR)$(PREFIX)/bin/regenerate
|
||||||
|
|
||||||
check:
|
check:
|
||||||
shellcheck sh/*
|
shellcheck sh/*
|
||||||
|
|
10
sh/tmenu_run
10
sh/tmenu_run
|
@ -4,9 +4,15 @@ tmenu_path () {
|
||||||
IFS=" :"
|
IFS=" :"
|
||||||
for i in $PATH; do
|
for i in $PATH; do
|
||||||
for j in "$i"/*; do
|
for j in "$i"/*; do
|
||||||
[ -f "$j" ] && [ -x "$j" ] && printf "%s\n" "$j"
|
[ -f "$j" ] && [ -x "$j" ] && printf "%s\n" "$j" | xargs basename
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
tmenu_path | tmenu | ${SHELL:-"/bin/sh"} &
|
if [ "$1" = "-g" ] || [ "$(basename $0)" = "regenerate" ]; then
|
||||||
|
mkdir -p $HOME/.local/share
|
||||||
|
tmenu_path > $HOME/.local/share/tmenu_cache
|
||||||
|
xmessage "regeneration complete"
|
||||||
|
else
|
||||||
|
cat $HOME/.local/share/tmenu_cache | tmenu | ${SHELL:-"/bin/sh"} &
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue