[dev] [surf] [PATCH] Fixed SETPROP() macro behaviour in config.def.h to handle escapes correctly.

From: Alexander Sedov <alex0player_AT_gmail.com>
Date: Thu, 21 Mar 2013 19:26:23 +0400

xprop prints information in format PROPERTY(STRING) = "escaped string",
which causes problem with repeated Ctrl-F: any non-ascii turns into
\ooo\ooo, this later turns into \\ooo\\ooo, and so on. To de-escape
string, echo -en is used, getting information from xargs -0; without
-0 xargs will try to handle escapes by itself and also do shenanigans
with quotes, which is totally undesired.
---
 config.def.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config.def.h b/config.def.h
index 052313c..3ddd6d7 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -23,7 +23,7 @@ static Bool hidebackground  = FALSE;
 
 #define SETPROP(p, q) { \
 	.v = (char *[]){ "/bin/sh", "-c", \
-		"prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | dmenu`\" &&" \
+		"prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 echo -en | dmenu`\" &&" \
 		"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
 		p, q, winid, NULL \
 	} \
-- 
1.7.10.4
Received on Thu Mar 21 2013 - 16:26:23 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 21 2013 - 16:36:05 CET