Return to repo list

suckless-gf-dmenu

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

commit 2f0656e7ca6bc8475183680e8e6713d8d3786d59
parent 8c1ba68f9b95fac3c3b53a370527fdff0444250a
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Thu, 20 Aug 2020 14:21:16 -0500

Added incremental

Diffstat:
Apatches/incremental/USAGE | 30++++++++++++++++++++++++++++++
Apatches/incremental/incremental.patch | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+), 0 deletions(-)

diff --git a/patches/incremental/USAGE b/patches/incremental/USAGE @@ -0,0 +1,30 @@ +incremental - Make dmenu print out the current text on each keypress +Source: https://tools.suckless.org/dmenu/patches/incremental/dmenu-incremental-20160702-3c91eed.diff +Original Author: Hiltjo Posthuma <hiltjo@codemadness.org> + +Description from source: + """ + This patch causes dmenu to print out the current text each time a key is pressed. + + This is useful as an incremental search feature, for example in surf's config.h: + + #define INCSEARCH { .v = (char *[]) { "/bin/sh", "-c", "dmenu -r < /dev/null | while read -r find; do xprop -id $0 -f _SURF_FIND 8s " "-set _SURF_FIND \"$find\"; done", winid, NULL } } + """ + +== YOU MUST == +(1). Place the patch file in /etc/portage/patches/x11-misc/dmenu/ +(2). Add the following line to your savedconfig file: + + static int incremental = 0; + +(3). Run 'emerge dmenu' + +== YOU PROBABLY SHOULD == +(1). Run dmenu with the '-r' option to use incremental output + +== PATCH MODIFICATIONS == +(1). Removed lines relating to config.def.h +(2). Changed chunk 2 in the dwm.c diff to be compatible with the current version of the 'usage' function + +== INCOMPATIBILITIES == +No known specific incompatibilities. diff --git a/patches/incremental/incremental.patch b/patches/incremental/incremental.patch @@ -0,0 +1,58 @@ +diff --git a/dmenu.1 b/dmenu.1 +index d3ab805..e5bf42f 100644 +--- a/dmenu.1 ++++ b/dmenu.1 +@@ -18,6 +18,7 @@ dmenu \- dynamic menu + .IR color ] + .RB [ \-nf + .IR color ] ++.RB [ \-r ] + .RB [ \-sb + .IR color ] + .RB [ \-sf +@@ -58,6 +59,9 @@ from 0. + .BI \-p " prompt" + defines the prompt to be displayed to the left of the input field. + .TP ++.B \-r ++dmenu outputs text each time a key is pressed. ++.TP + .BI \-fn " font" + defines the font or font set used. + .TP +diff --git a/dmenu.c b/dmenu.c +index e0c2f80..7f1be56 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -447,6 +447,10 @@ keypress(XKeyEvent *ev) + match(); + break; + } ++ if (incremental) { ++ puts(text); ++ fflush(stdout); ++ } + drawmenu(); + } + +@@ -614,7 +615,7 @@ static void + usage(void) + { + fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" +- " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr); ++ " [-nb color] [-nf color] [-r] [-sb color] [-sf color] [-w windowid]\n", stderr); + exit(1); + } + +@@ -629,6 +633,8 @@ main(int argc, char *argv[]) + topbar = 0; + else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ + fast = 1; ++ else if (!strcmp(argv[i], "-r")) /* incremental */ ++ incremental = 1; + else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ + fstrncmp = strncasecmp; + fstrstr = cistrstr; +-- +2.8.3 +