[PATCH] Improve dmenu with prompt and a font

From: Ivan Tham <pickfire_AT_riseup.net>
Date: Tue, 6 Oct 2015 18:44:27 +0800

---
 config.def.h | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1eb9566..4d2216a 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -13,6 +13,7 @@ static Bool runinfullscreen = FALSE; /* Run in fullscreen mode by default */
 
 static guint defaultfontsize = 12;   /* Default font size */
 static gfloat zoomlevel = 1.0;       /* Default zoom level */
+static char dmenufont[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
 
 /* Soup default features */
 static char *cookiefile     = "~/.surf/cookies.txt";
_AT_@ -35,11 +36,15 @@ static Bool loadimages            = TRUE;
 static Bool hidebackground        = FALSE;
 static Bool allowgeolocation      = TRUE;
 
-#define SETPROP(p, q) { \
+/* Prompt */
+#define P_GO    "Go to"
+#define P_FIND  "Find"
+
+#define SETPROP(p, q, prompt) { \
 	.v = (char *[]){ "/bin/sh", "-c", \
-		"prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 printf %b | dmenu`\" &&" \
+		"prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 printf %b | dmenu -p \"$3\" -fn $4`\" &&" \
 		"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
-		p, q, winid, NULL \
+		p, q, winid, prompt, dmenufont, NULL \
 	} \
 }
 
_AT_@ -110,9 +115,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", P_GO) },
+    { MODKEY,               GDK_f,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND", P_FIND) },
+    { MODKEY,               GDK_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND", P_FIND) },
 
     { MODKEY,               GDK_n,      find,       { .b = TRUE } },
     { MODKEY|GDK_SHIFT_MASK,GDK_n,      find,       { .b = FALSE } },
-- 
2.6.0
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Tue Oct 06 2015 - 14:24:09 CEST