--- config.def.h | 2 ++ dmenu.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/config.def.h b/config.def.h index 4e5e3e7..22ef78b 100644 --- a/config.def.h +++ b/config.def.h _AT_@ -4,6 +4,8 @@ /* Default settings; can be overrided by command line. */ static Bool topbar = True; /* -b option; if False, dmenu appears at bottom */ +static Bool instant = False; /* -n option; if True, dmenu ends immediately */ + /* on a distinct match */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { "monospace:size=10" diff --git a/dmenu.c b/dmenu.c index f0bc176..a357692 100644 --- a/dmenu.c +++ b/dmenu.c _AT_@ -93,6 +93,8 @@ main(int argc, char *argv[]) { fstrncmp = strncasecmp; fstrstr = cistrstr; } + else if(!strcmp(argv[i], "-n")) /* instant match */ + instant = !instant; else if(i+1 == argc) usage(); /* these options take one argument */ _AT_@ -511,6 +513,11 @@ match(void) { matchend = substrend; } curr = sel = matches; + if(instant && matches && matches==matchend && !lsubstr) { + puts(matches->text); + cleanup(); + exit(0); + } calcoffsets(); } -- 2.5.0Received on Sun Aug 30 2015 - 14:57:27 CEST
This archive was generated by hypermail 2.3.0 : Sun Aug 30 2015 - 15:00:12 CEST