[hackers] [dmenu] dmenu_run: Split cache logic to dmenu_path again || Quentin Glidic
changeset: 489:b491483be453
tag: tip
user: Quentin Glidic <sardemff7+hg_AT_sardemff7.net>
date: Mon Jul 30 17:02:12 2012 +0200
files: Makefile dmenu_path dmenu_run
description:
dmenu_run: Split cache logic to dmenu_path again
This allows to run dmenu_path to update the cache using
a packager manager hook system
diff -r 6b2b356f9b49 -r b491483be453 Makefile
--- a/Makefile Tue May 15 11:47:54 2012 +0200
+++ b/Makefile Mon Jul 30 17:02:12 2012 +0200
_AT_@ -35,7 +35,7 @@
dist: clean
_AT_echo creating dist tarball
_AT_mkdir -p dmenu-${VERSION}
- _AT_cp LICENSE Makefile README config.mk dmenu.1 draw.h dmenu_run stest.1 ${SRC} dmenu-${VERSION}
+ _AT_cp LICENSE Makefile README config.mk dmenu.1 draw.h dmenu_path dmenu_run stest.1 ${SRC} dmenu-${VERSION}
_AT_tar -cf dmenu-${VERSION}.tar dmenu-${VERSION}
_AT_gzip dmenu-${VERSION}.tar
_AT_rm -rf dmenu-${VERSION}
_AT_@ -43,8 +43,9 @@
install: all
_AT_echo installing executables to ${DESTDIR}${PREFIX}/bin
_AT_mkdir -p ${DESTDIR}${PREFIX}/bin
- _AT_cp -f dmenu dmenu_run stest ${DESTDIR}${PREFIX}/bin
+ _AT_cp -f dmenu dmenu_path dmenu_run stest ${DESTDIR}${PREFIX}/bin
_AT_chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu
+ _AT_chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu_path
_AT_chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu_run
_AT_chmod 755 ${DESTDIR}${PREFIX}/bin/stest
_AT_echo installing manual pages to ${DESTDIR}${MANPREFIX}/man1
_AT_@ -57,6 +58,7 @@
uninstall:
_AT_echo removing executables from ${DESTDIR}${PREFIX}/bin
_AT_rm -f ${DESTDIR}${PREFIX}/bin/dmenu
+ _AT_rm -f ${DESTDIR}${PREFIX}/bin/dmenu_path
_AT_rm -f ${DESTDIR}${PREFIX}/bin/dmenu_run
_AT_rm -f ${DESTDIR}${PREFIX}/bin/stest
_AT_echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
diff -r 6b2b356f9b49 -r b491483be453 dmenu_path
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dmenu_path Mon Jul 30 17:02:12 2012 +0200
_AT_@ -0,0 +1,13 @@
+#!/bin/sh
+cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
+if [ -d "$cachedir" ]; then
+ cache=$cachedir/dmenu_run
+else
+ cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
+fi
+IFS=:
+if stest -dqr -n "$cache" $PATH; then
+ stest -flx $PATH | sort -u | tee "$cache"
+else
+ cat "$cache"
+fi
diff -r 6b2b356f9b49 -r b491483be453 dmenu_run
--- a/dmenu_run Tue May 15 11:47:54 2012 +0200
+++ b/dmenu_run Mon Jul 30 17:02:12 2012 +0200
_AT_@ -1,15 +1,2 @@
#!/bin/sh
-cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
-if [ -d "$cachedir" ]; then
- cache=$cachedir/dmenu_run
-else
- cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
-fi
-(
- IFS=:
- if stest -dqr -n "$cache" $PATH; then
- stest -flx $PATH | sort -u | tee "$cache" | dmenu "$_AT_"
- else
- dmenu "$_AT_" < "$cache"
- fi
-) | ${SHELL:-"/bin/sh"} &
+dmenu_path | dmenu "$_AT_" | ${SHELL:-"/bin/sh"} &
Received on Thu Aug 09 2012 - 01:19:58 CEST
This archive was generated by hypermail 2.3.0
: Thu Aug 09 2012 - 01:24:07 CEST