[wiki] [sites] [dmenu] add instant mode patch || Michael Stummvoll

From: <git_AT_suckless.org>
Date: Mon, 31 Aug 2015 13:42:40 +0200

commit 2a3ab02ccc1c2cd8a39afc713a87f8b3b1e290da
Author: Michael Stummvoll <michael.stummvoll_AT_autinity.de>
Date: Mon Aug 31 13:42:33 2015 +0200

    [dmenu] add instant mode patch

diff --git a/tools.suckless.org/dmenu/patches/dmenu-instant.diff b/tools.suckless.org/dmenu/patches/dmenu-instant.diff
new file mode 100644
index 0000000..6f7cec6
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/dmenu-instant.diff
_AT_@ -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
+_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();
+ }
+
diff --git a/tools.suckless.org/dmenu/patches/instant.md b/tools.suckless.org/dmenu/patches/instant.md
new file mode 100644
index 0000000..935f22a
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/instant.md
_AT_@ -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_AT_stummi.org>
Received on Mon Aug 31 2015 - 13:42:40 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 31 2015 - 13:48:12 CEST