commit aade850357394f2a14cfaa31ffd68be7ac98a370
parent f8b5e516c6c2afb914a5077817510e2db2a6cf72
Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 19 Apr 2017 18:34:16 +0200
Adding prompts to SETPROP.
The idea was taken from Ben Woolley <tautolog@gmail.com>.
Diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -36,13 +36,17 @@ static Bool loadimages = TRUE;
static Bool hidebackground = FALSE;
static Bool allowgeolocation = TRUE;
-#define SETPROP(p, q) { \
+#define PROMPT_GOTO "Go To"
+#define PROMPT_FIND "Find"
+#define PROMPT_SLASH "/"
+
+#define SETPROP(p, q, prompt) { \
.v = (char *[]){ "/bin/sh", "-c", \
"prop=\"`xprop -id $2 $0 " \
"| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \
- "| xargs -0 printf %b | dmenu`\" &&" \
+ "| xargs -0 printf %b | dmenu -p \"$3\"`\" &&" \
"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
- p, q, winid, NULL \
+ p, q, winid, prompt, NULL \
} \
}
@@ -113,9 +117,9 @@ static Key keys[] = {
{ MODKEY, GDK_o, source, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_o, inspector, { 0 } },
- { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
- { MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
- { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
+ { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GOTO) },
+ { MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+ { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_SLASH) },
{ MODKEY, GDK_n, find, { .b = TRUE } },
{ MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },