sites

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

commit bd9cc9c91425cd1fa9732bebc3445f68f6635e8c
parent 2a4c61059193c03860e2168dfcafb3d0cdb85098
Author: Ayrton <a.munoz3327@gmail.com>
Date:   Thu, 30 Jun 2016 00:09:47 -0400

[dmenu][pipeout] new patch

added a new patch for piping selected item to dmenu

Diffstat:
Atools.suckless.org/dmenu/patches/dmenu-4.6-pipeout.diff | 44++++++++++++++++++++++++++++++++++++++++++++
Atools.suckless.org/dmenu/patches/pipeout.md | 17+++++++++++++++++
2 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/dmenu/patches/dmenu-4.6-pipeout.diff b/tools.suckless.org/dmenu/patches/dmenu-4.6-pipeout.diff @@ -0,0 +1,44 @@ +diff --git a/config.def.h b/config.def.h +index dcffd38..8c18a07 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -20,4 +20,5 @@ static unsigned int lines = 0; + * Characters not considered part of a word while deleting words + * for example: " /?\"&[]" + */ ++static const char startpipe[] = "#"; + static const char worddelimiters[] = " "; +diff --git a/dmenu.c b/dmenu.c +index e0c2f80..9ed07bc 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -35,6 +35,7 @@ struct item { + }; + + static char text[BUFSIZ] = ""; ++static char pipeout[8] = " | dmenu"; + static int bh, mw, mh; + static int sw, sh; /* X display screen geometry width, height */ + static int inputw, promptw; +@@ -416,7 +417,20 @@ keypress(XKeyEvent *ev) + break; + case XK_Return: + case XK_KP_Enter: +- puts((sel && !(ev->state & ShiftMask)) ? sel->text : text); ++ if ((sel && !(ev->state & ShiftMask))) { ++ if (sel->text[0] == startpipe[0]) { ++ strncpy(sel->text + strlen(sel->text),pipeout,8); ++ puts(sel->text+1); ++ } ++ puts(sel->text); ++ } ++ else { ++ if (text[0] == startpipe[0]) { ++ strncpy(text + strlen(text),pipeout,8); ++ puts(text+1); ++ } ++ puts(text); ++ } + if (!(ev->state & ControlMask)) { + cleanup(); + exit(0); diff --git a/tools.suckless.org/dmenu/patches/pipeout.md b/tools.suckless.org/dmenu/patches/pipeout.md @@ -0,0 +1,17 @@ +pipeout +======= + +Description +----------- + +This patch allows the selected text to be piped back out with dmenu. This is useful if you want to display the output of a command. + +Download +-------- + +* [dmenu-4.6-pipeout.diff](dmenu-4.6-pipeout.diff) + +Author +------ + +* Ayrton