added initial text patch

This commit is contained in:
Alexander Bocken 2020-12-24 14:27:52 +01:00
parent f4dd6fa68d
commit b2a36856e7
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8
2 changed files with 10 additions and 2 deletions

View File

@ -22,6 +22,8 @@ dmenu \- dynamic menu
.IR color ]
.RB [ \-w
.IR windowid ]
.RB [ \-it
.IR text ]
.P
.BR dmenu_run " ..."
.SH DESCRIPTION
@ -83,6 +85,9 @@ prints version information to stdout, then exits.
.TP
.BI \-w " windowid"
embed into windowid.
.TP
.BI \-it " text".
start with initial text input.
.SH USAGE
dmenu is completely controlled by the keyboard. Items are selected using the
arrow keys, page up, page down, home, and end.

View File

@ -697,7 +697,7 @@ static void
usage(void)
{
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);
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid] [-it text]\n", stderr);
exit(1);
}
@ -742,7 +742,10 @@ main(int argc, char *argv[])
colors[SchemeSel][ColFg] = argv[++i];
else if (!strcmp(argv[i], "-w")) /* embedding window id */
embed = argv[++i];
else
else if (!strcmp(argv[i], "-it")) { /* embedding window id */
const char * text = argv[++i];
insert(text, strlen(text));
} else
usage();
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())