dmenu-pipeout-20160701-3c91eed.diff - sites - public wiki contents of suckless.… | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dmenu-pipeout-20160701-3c91eed.diff (1257B) | |
--- | |
1 diff --git a/config.def.h b/config.def.h | |
2 index dcffd38..8c18a07 100644 | |
3 --- a/config.def.h | |
4 +++ b/config.def.h | |
5 @@ -20,4 +20,5 @@ static unsigned int lines = 0; | |
6 * Characters not considered part of a word while deleting words | |
7 * for example: " /?\"&[]" | |
8 */ | |
9 +static const char startpipe[] = "#"; | |
10 static const char worddelimiters[] = " "; | |
11 diff --git a/dmenu.c b/dmenu.c | |
12 index e0c2f80..9ed07bc 100644 | |
13 --- a/dmenu.c | |
14 +++ b/dmenu.c | |
15 @@ -35,6 +35,7 @@ struct item { | |
16 }; | |
17 | |
18 static char text[BUFSIZ] = ""; | |
19 +static char pipeout[8] = " | dmenu"; | |
20 static int bh, mw, mh; | |
21 static int sw, sh; /* X display screen geometry width, height */ | |
22 static int inputw, promptw; | |
23 @@ -416,7 +417,20 @@ keypress(XKeyEvent *ev) | |
24 break; | |
25 case XK_Return: | |
26 case XK_KP_Enter: | |
27 - puts((sel && !(ev->state & ShiftMask)) ? sel->text : te… | |
28 + if ((sel && !(ev->state & ShiftMask))) { | |
29 + if (sel->text[0] == startpipe[0]) { | |
30 + strncpy(sel->text + strlen(sel->text),pipeout,8); | |
31 + puts(sel->text+1); | |
32 + } | |
33 + puts(sel->text); | |
34 + } | |
35 + else { | |
36 + if (text[0] == startpipe[0]) { | |
37 + strncpy(text + strlen(text),pipeout,8); | |
38 + puts(text+1); | |
39 + } | |
40 + puts(text); | |
41 + } | |
42 if (!(ev->state & ControlMask)) { | |
43 cleanup(); | |
44 exit(0); |