The attached match makes dmenu print out the input text as it is entered, rather than just the final selection.
This is useful if you make surf run the following shell script snippet... dmenu -r -p find: |\ while read -r find; do xprop -id $xid -f _SURF_FIND 8s -set _SURF_FIND "$find" done ... which gets you [the basics of] usable incremental search.
diff -r 545ec6141dc4 dmenu.1 --- a/dmenu.1 Wed May 05 11:42:39 2010 +0100 +++ b/dmenu.1 Wed May 05 21:04:44 2010 +0200 @@ -5,6 +5,7 @@ .B dmenu .RB [ \-i ] .RB [ \-b ] +.RB [ \-r ] .RB [ \-l " <lines>"] .RB [ \-fn " <font>"] .RB [ \-nb " <color>"] @@ -27,6 +28,9 @@ .B \-b defines that dmenu appears at the bottom. .TP +.B \-r +incrementally print text on standard output as it is entered. +.TP .B \-l <lines> activates vertical list mode. The given number of lines will be displayed. Window height will get adjusted. diff -r 545ec6141dc4 dmenu.c --- a/dmenu.c Wed May 05 11:42:39 2010 +0100 +++ b/dmenu.c Wed May 05 21:04:44 2010 +0200 @@ -80,6 +80,7 @@ static int ret = 0; static int cursor = 0; static int screen; +static int incremental; static unsigned int mw, mh; static unsigned int numlockmask = 0; static Bool running = True; @@ -574,6 +575,10 @@ if(!pattern) return; + if (incremental) { + fprintf(stdout, "%s\n", text); + fflush(stdout); + } plen = strlen(pattern); item = lexact = lprefix = lsubstr = itemend = exactend = prefixend = substrend = NULL; for(i = allitems; i; i = i->next) @@ -770,6 +775,9 @@ } else if(!strcmp(argv[i], "-b")) topbar = False; + else if(!strcmp(argv[i], "-r")) { + incremental = 1; + } else if(!strcmp(argv[i], "-e")) { if(++i < argc) parent = atoi(argv[i]); } @@ -798,7 +806,7 @@ else if(!strcmp(argv[i], "-v")) eprint("dmenu-"VERSION", © 2006-2010 dmenu engineers, see LICENSE for details\n"); else - eprint("usage: dmenu [-i] [-b] [-e <xid>] [-l <lines>] [-fn <font>] [-nb <color>]\n" + eprint("usage: dmenu [-i] [-b] [-r] [-e <xid>] [-l <lines>] [-fn <font>] [-nb <color>]\n" " [-nf <color>] [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n"); if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fprintf(stderr, "warning: no locale support\n");
-- \ Troels /\ Henriksen