--- a/config.h 2009-04-18 13:50:04.000000000 +0200 +++ b/config.h 2009-09-26 18:50:22.000000000 +0200 @@ -1,9 +1,9 @@ /* See LICENSE file for copyright and license details. */ /* appearance */ -static const char *font = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*"; -static const char *normbgcolor = "#cccccc"; -static const char *normfgcolor = "#000000"; -static const char *selbgcolor = "#0066ff"; +static const char *font = "-misc-fixed-medium-r-*-*-14-*-*-*-*-*-*-*"; +static const char *normbgcolor = "#000000"; +static const char *normfgcolor = "#00ff00"; +static const char *selbgcolor = "darkgreen"; static const char *selfgcolor = "#ffffff"; static unsigned int spaceitem = 30; /* px between menu items */ --- a/dmenu.c 2009-04-18 13:50:04.000000000 +0200 +++ b/dmenu.c 2009-09-26 18:50:58.000000000 +0200 @@ -69,6 +69,8 @@ static int textw(const char *text); /* variables */ static char *maxname = NULL; static char *prompt = NULL; +static Bool autoconfirm = False; +static Bool flautoconfirm = False; static char text[4096]; static int cmdw = 0; static int promptw = 0; @@ -514,6 +516,18 @@ match(char *pattern) { } curr = prev = next = sel = item; calcoffsets(); + + if(autoconfirm && item && !item->right) { + fprintf(stdout, "%s", item->text); + fflush(stdout); + running=False; + } + + if(flautoconfirm && item && item==itemend) { + fprintf(stdout, "%s", item->text); + fflush(stdout); + running=False; + } } void @@ -674,6 +688,10 @@ main(int argc, char *argv[]) { fstrncmp = strncasecmp; fstrstr = cistrstr; } + else if(!strcmp(argv[i], "-a")) + autoconfirm = True; + else if(!strcmp(argv[i], "-fl")) + flautoconfirm = True; else if(!strcmp(argv[i], "-b")) topbar = False; else if(!strcmp(argv[i], "-fn")) { --- a/dmenu.1 2009-04-18 13:50:04.000000000 +0200 +++ b/dmenu.1 2009-09-26 18:50:49.000000000 +0200 @@ -5,6 +5,8 @@ dmenu \- dynamic menu .B dmenu .RB [ \-i ] .RB [ \-b ] +.RB [ \-a ] +.RB [ \-fl] .RB [ \-fn " "] .RB [ \-nb " "] .RB [ \-nf " "] @@ -26,6 +28,14 @@ makes dmenu match menu entries case inse .B \-b defines that dmenu appears at the bottom. .TP +.B \-a +makes dmenu autoconfirm, useful on recursive script. +.TP +.B \-fl +similar to -a but doesn't care of substring, +you have to type from first letter to match. +Decrease the number of item faster on non-similar-begin item list. +.TP .B \-fn defines the font. .TP