[wiki] [sites] [dmenu][pipeout] new patch || Ayrton

From: <git_AT_suckless.org>
Date: Thu, 30 Jun 2016 06:11:27 +0200

commit bd9cc9c91425cd1fa9732bebc3445f68f6635e8c
Author: Ayrton <a.munoz3327_AT_gmail.com>
Date: Thu Jun 30 00:09:47 2016 -0400

    [dmenu][pipeout] new patch
    
    added a new patch for piping selected item to dmenu

diff --git a/tools.suckless.org/dmenu/patches/dmenu-4.6-pipeout.diff b/tools.suckless.org/dmenu/patches/dmenu-4.6-pipeout.diff
new file mode 100644
index 0000000..85c0054
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/dmenu-4.6-pipeout.diff
_AT_@ -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
+_AT_@ -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
+_AT_@ -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;
+_AT_@ -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
new file mode 100644
index 0000000..6a417ee
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/pipeout.md
_AT_@ -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
Received on Thu Jun 30 2016 - 06:11:27 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 30 2016 - 06:12:14 CEST