sites

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

dmenu-initialtext-4.7.diff (1409B)


      1 diff --git a/dmenu.1 b/dmenu.1
      2 index 9eab758..b4947f9 100644
      3 --- a/dmenu.1
      4 +++ b/dmenu.1
      5 @@ -22,6 +22,8 @@ dmenu \- dynamic menu
      6  .IR color ]
      7  .RB [ \-w
      8  .IR windowid ]
      9 +.RB [ \-it
     10 +.IR text ]
     11  .P
     12  .BR dmenu_run " ..."
     13  .SH DESCRIPTION
     14 @@ -80,6 +82,9 @@ prints version information to stdout, then exits.
     15  .TP
     16  .BI \-w " windowid"
     17  embed into windowid.
     18 +.TP
     19 +.BI \-it " text".
     20 +start with initial text input.
     21  .SH USAGE
     22  dmenu is completely controlled by the keyboard.  Items are selected using the
     23  arrow keys, page up, page down, home, and end.
     24 diff --git a/dmenu.c b/dmenu.c
     25 index d605ab4..0564dfe 100644
     26 --- a/dmenu.c
     27 +++ b/dmenu.c
     28 @@ -637,7 +637,8 @@ static void
     29  usage(void)
     30  {
     31  	fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
     32 -	      "             [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
     33 +	      "             [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n"
     34 +	      "             [-it text]\n", stderr);
     35  	exit(1);
     36  }
     37  
     38 @@ -680,7 +681,10 @@ main(int argc, char *argv[])
     39  			colors[SchemeSel][ColFg] = argv[++i];
     40  		else if (!strcmp(argv[i], "-w"))   /* embedding window id */
     41  			embed = argv[++i];
     42 -		else
     43 +		else if (!strcmp(argv[i], "-it")) {   /* embedding window id */
     44 +			const char * text = argv[++i];
     45 +			insert(text, strlen(text));
     46 +		} else
     47  			usage();
     48  
     49  	if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())