Hi,
Three patches are attached:
dmenu_run.patch:
- replace $* with "$@" so dmenu_run -p "foo bar" works
dmenu_path.patch:
- no need for ${file##*/} string replacement
- sort -u instead of sort | uniq
- quote CACHE variable (HOME may contain an IFS character)
- error checking with &&
slock.patch:
- use numpad code from dmenu
Also, with the new DPMS code from changeset 31, slock crashes here
(X.org server 1.4.0.90, DPMS disabled in xorg.conf):
| X Error of failed request: BadMatch (invalid parameter attributes)
| Major opcode of failed request: 136 (DPMS)
| Minor opcode of failed request: 6 (DPMSForceLevel)
| Serial number of failed request: 27
| Current serial number in output stream: 28
Regards,
Peter
diff -r 612d48273009 dmenu_run
--- a/dmenu_run Thu Apr 03 21:56:19 2008 +0100
+++ b/dmenu_run Mon Apr 07 22:17:29 2008 +0200
@@ -1,2 +1,2 @@
#!/bin/sh
-exe=`dmenu_path | dmenu $*` && exec $exe
+exe=`dmenu_path | dmenu "$@"` && exec $exe
diff -r 612d48273009 dmenu_path
--- a/dmenu_path Thu Apr 03 21:56:19 2008 +0100
+++ b/dmenu_path Mon Apr 07 22:17:24 2008 +0200
@@ -3,24 +3,24 @@
IFS=:
uptodate() {
- test ! -f $CACHE && return 1
+ test -f "$CACHE" &&
for dir in $PATH
do
- test $dir -nt $CACHE && return 1
+ test ! $dir -nt "$CACHE" || return 1
done
- return 0
}
if ! uptodate
then
for dir in $PATH
do
- for file in "$dir"/*
+ cd "$dir" &&
+ for file in *
do
- test -x "$file" && echo "${file##*/}"
+ test -x "$file" && echo "$file"
done
- done | sort | uniq > $CACHE.$$
- mv $CACHE.$$ $CACHE
+ done | sort -u > "$CACHE".$$ &&
+ mv "$CACHE".$$ "$CACHE"
fi
-cat $CACHE
+cat "$CACHE"
diff -r 8a784031d90a slock.c
--- a/slock.c Thu Mar 13 16:59:01 2008 +0000
+++ b/slock.c Mon Apr 07 22:14:29 2008 +0200
@@ -131,6 +131,11 @@
if(ev.type == KeyPress) {
buf[0] = 0;
num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym,
0);
+ if(IsKeypadKey(ksym))
+ if(ksym == XK_KP_Enter)
+ ksym = XK_Return;
+ else if(ksym >= XK_KP_0 && ksym <= XK_KP_9)
+ ksym = (ksym - XK_KP_0) + XK_0;
if(IsFunctionKey(ksym) || IsKeypadKey(ksym)
|| IsMiscFunctionKey(ksym) ||
IsPFKey(ksym)
|| IsPrivateKeypadKey(ksym))