Return to repo list

suckless-gf-dmenu

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

incremental.patch (1410B)


      1 diff --git a/dmenu.1 b/dmenu.1
      2 index d3ab805..e5bf42f 100644
      3 --- a/dmenu.1
      4 +++ b/dmenu.1
      5 @@ -18,6 +18,7 @@ dmenu \- dynamic menu
      6  .IR color ]
      7  .RB [ \-nf
      8  .IR color ]
      9 +.RB [ \-r ]
     10  .RB [ \-sb
     11  .IR color ]
     12  .RB [ \-sf
     13 @@ -58,6 +59,9 @@ from 0.
     14  .BI \-p " prompt"
     15  defines the prompt to be displayed to the left of the input field.
     16  .TP
     17 +.B \-r
     18 +dmenu outputs text each time a key is pressed.
     19 +.TP
     20  .BI \-fn " font"
     21  defines the font or font set used.
     22  .TP
     23 diff --git a/dmenu.c b/dmenu.c
     24 index e0c2f80..7f1be56 100644
     25 --- a/dmenu.c
     26 +++ b/dmenu.c
     27 @@ -447,6 +447,10 @@ keypress(XKeyEvent *ev)
     28  		match();
     29  		break;
     30  	}
     31 +	if (incremental) {
     32 +		puts(text);
     33 +		fflush(stdout);
     34 +	}
     35  	drawmenu();
     36  }
     37  
     38 @@ -614,7 +615,7 @@ static void
     39  usage(void)
     40  {
     41  	fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
     42 -	      "             [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
     43 +	      "             [-nb color] [-nf color] [-r] [-sb color] [-sf color] [-w windowid]\n", stderr);
     44  	exit(1);
     45  }
     46  
     47 @@ -629,6 +633,8 @@ main(int argc, char *argv[])
     48  			topbar = 0;
     49  		else if (!strcmp(argv[i], "-f"))   /* grabs keyboard before reading stdin */
     50  			fast = 1;
     51 +		else if (!strcmp(argv[i], "-r"))   /* incremental */
     52 +			incremental = 1;
     53  		else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
     54  			fstrncmp = strncasecmp;
     55  			fstrstr = cistrstr;
     56 -- 
     57 2.8.3
     58