Improve SETPROP xprop parsing
This handles correctly quotes, backslashes, etc.
This commit is contained in:
parent
761ea9e4c6
commit
238d2273b5
1 changed files with 6 additions and 4 deletions
10
config.def.h
10
config.def.h
|
@ -67,10 +67,12 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
|
||||||
/* SETPROP(readprop, setprop, prompt)*/
|
/* SETPROP(readprop, setprop, prompt)*/
|
||||||
#define SETPROP(r, s, p) { \
|
#define SETPROP(r, s, p) { \
|
||||||
.v = (const char *[]){ "/bin/sh", "-c", \
|
.v = (const char *[]){ "/bin/sh", "-c", \
|
||||||
"prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
|
"prop=\"$(printf '%b' \"$(xprop -id $1 "r" " \
|
||||||
"| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \
|
"| sed -e 's/^"r"(STRING) = \"\\(.*\\)\"/\\1/' " \
|
||||||
"| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
|
" -e 's/\\\\\\(.\\)/\\1/g')\" " \
|
||||||
"surf-setprop", winid, r, s, p, NULL \
|
"| dmenu -p '"p"' -w $1)\" " \
|
||||||
|
"&& xprop -id $1 -f "s" 8s -set "s" \"$prop\"", \
|
||||||
|
"surf-setprop", winid, NULL \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue