-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmenu-initialtext-4.7.diff
49 lines (47 loc) · 1.38 KB
/
dmenu-initialtext-4.7.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff --git a/dmenu.1 b/dmenu.1
index 9eab758..b4947f9 100644
--- a/dmenu.1
+++ b/dmenu.1
@@ -22,6 +22,8 @@ dmenu \- dynamic menu
.IR color ]
.RB [ \-w
.IR windowid ]
+.RB [ \-it
+.IR text ]
.P
.BR dmenu_run " ..."
.SH DESCRIPTION
@@ -80,6 +82,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.
diff --git a/dmenu.c b/dmenu.c
index d605ab4..0564dfe 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -637,7 +637,8 @@ 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] [-sb color] [-sf color] [-w windowid]\n"
+ " [-it text]\n", stderr);
exit(1);
}
@@ -680,7 +681,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())