sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 2a3ab02ccc1c2cd8a39afc713a87f8b3b1e290da
parent ba63731c9c2beb41acbf24f03d5833ae653a76b3
Author: Michael Stummvoll <michael.stummvoll@autinity.de>
Date:   Mon, 31 Aug 2015 13:42:33 +0200

[dmenu] add instant mode patch

Diffstat:
Atools.suckless.org/dmenu/patches/dmenu-instant.diff | 38++++++++++++++++++++++++++++++++++++++
Atools.suckless.org/dmenu/patches/instant.md | 12++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/dmenu/patches/dmenu-instant.diff b/tools.suckless.org/dmenu/patches/dmenu-instant.diff @@ -0,0 +1,38 @@ +diff --git a/config.def.h b/config.def.h +index 4e5e3e7..22ef78b 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -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 +@@ -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 */ +@@ -511,6 +513,11 @@ match(void) { + matchend = substrend; + } + curr = sel = matches; ++ if(instant && matches && matches==matchend && !lsubstr) { ++ puts(matches->text); ++ cleanup(); ++ exit(0); ++ } + calcoffsets(); + } + diff --git a/tools.suckless.org/dmenu/patches/instant.md b/tools.suckless.org/dmenu/patches/instant.md @@ -0,0 +1,12 @@ +Instant Mode +============ + +Adds an flag which will cause dmenu to select an item immediately if theres one matching option left. + +Download +-------- +* [dmenu-instant.diff](dmenu-instant.diff) + +Author +------ +* Michael Stummvoll (stummi)<suckless@stummi.org>