Return to repo list

suckless-gf-dmenu

Gentoo-friendly patches for Suckless's dmenu.
Return to HMagellan.com

commit 3af2b81393103c6518f30f3a8c64bbb2727b1df8
parent 18bb45c510c800411feb0f2ead2c93662785a92c
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Thu, 20 Aug 2020 15:41:03 -0500

Added instant

Diffstat:
Apatches/instant/USAGE | 23+++++++++++++++++++++++
Apatches/instant/instant-nodoc.patch | 29+++++++++++++++++++++++++++++
Apatches/instant/instant.patch | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 113 insertions(+), 0 deletions(-)

diff --git a/patches/instant/USAGE b/patches/instant/USAGE @@ -0,0 +1,23 @@ +instant - Instantly launch a command if it is the last option in dmenu +Source: https://tools.suckless.org/dmenu/patches/instant/dmenu-instant-4.7.diff +Original Author: Michael Stummvoll (stummi)suckless@stummi.org + +Description from source: + """ + Adds an flag which will cause dmenu to select an item immediately if theres one matching option left. + """ + +== YOU MUST == +(1). Place the patch file in /etc/portage/patches/x11-misc/dmenu/ and run 'emerge dmenu' + +== YOU PROBABLY SHOULD == +No further action is required. + +== PATCH MODIFICATIONS == +(1). Removed all changes made to 'config.def.h' +(2). Added a 'nodoc' patch version which strips out added documentation + +== INCOMPATIBILITIES == +THIS PATCH MAKES CHANGES TO DMENU'S BUILT-IN DOCUMENTATION, WHICH CAN CAUSE CONFLICTS WITH OTHER PATCHES! +If you encounter such conflicts, try emerging with the 'instant-nodoc.patch' file instead. It is the +same as the 'instant.patch' file except it makes no changes to the documentation. diff --git a/patches/instant/instant-nodoc.patch b/patches/instant/instant-nodoc.patch @@ -0,0 +1,29 @@ +diff --git a/dmenu.c b/dmenu.c +index d605ab4..2c2f03e 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -260,6 +260,13 @@ match(void) + matchend = substrend; + } + curr = sel = matches; ++ ++ if(instant && matches && matches==matchend && !lsubstr) { ++ puts(matches->text); ++ cleanup(); ++ exit(0); ++ } ++ + calcoffsets(); + } + +@@ -659,7 +666,9 @@ main(int argc, char *argv[]) + else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ + fstrncmp = strncasecmp; + fstrstr = cistrstr; +- } else if (i + 1 == argc) ++ } else if (!strcmp(argv[i], "-n")) /* instant select only match */ ++ instant = 1; ++ else if (i + 1 == argc) + usage(); + /* these options take one argument */ + else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */ diff --git a/patches/instant/instant.patch b/patches/instant/instant.patch @@ -0,0 +1,61 @@ +diff --git a/dmenu.1 b/dmenu.1 +index 9eab758..98d3725 100644 +--- a/dmenu.1 ++++ b/dmenu.1 +@@ -3,7 +3,7 @@ + dmenu \- dynamic menu + .SH SYNOPSIS + .B dmenu +-.RB [ \-bfiv ] ++.RB [ \-bfinv ] + .RB [ \-l + .IR lines ] + .RB [ \-m +@@ -47,6 +47,9 @@ X until stdin reaches end\-of\-file. + .B \-i + dmenu matches menu items case insensitively. + .TP ++.B \-n ++dmenu instantly selects if only one match. ++.TP + .BI \-l " lines" + dmenu lists items vertically, with the given number of lines. + .TP +diff --git a/dmenu.c b/dmenu.c +index d605ab4..2c2f03e 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -260,6 +260,13 @@ match(void) + matchend = substrend; + } + curr = sel = matches; ++ ++ if(instant && matches && matches==matchend && !lsubstr) { ++ puts(matches->text); ++ cleanup(); ++ exit(0); ++ } ++ + calcoffsets(); + } + +@@ -636,7 +643,7 @@ setup(void) + static void + usage(void) + { +- fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" ++ fputs("usage: dmenu [-bfinv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" + " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr); + exit(1); + } +@@ -659,7 +666,9 @@ main(int argc, char *argv[]) + else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ + fstrncmp = strncasecmp; + fstrstr = cistrstr; +- } else if (i + 1 == argc) ++ } else if (!strcmp(argv[i], "-n")) /* instant select only match */ ++ instant = 1; ++ else if (i + 1 == argc) + usage(); + /* these options take one argument */ + else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */