[wiki] [sites] dmenu: update xyw patch || Alessandro Caputo

From: <git_AT_suckless.org>
Date: Thu, 07 Dec 2017 16:00:15 +0100

commit 6f1d9cdf277f2d2e3fc92bd9dc50b33d58ae9dc8
Author: Alessandro Caputo <nonedisponibile_AT_gmail.com>
Date: Thu Dec 7 16:00:10 2017 +0100

    dmenu: update xyw patch

diff --git a/tools.suckless.org/dmenu/patches/dmenu-xyw-20171207-f0a5b75.diff b/tools.suckless.org/dmenu/patches/dmenu-xyw-20171207-f0a5b75.diff
new file mode 100644
index 00000000..442fa34c
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/dmenu-xyw-20171207-f0a5b75.diff
_AT_@ -0,0 +1,102 @@
+From 204361f6d459b50eb513a9ccc01d775d71388bc3 Mon Sep 17 00:00:00 2001
+From: Alessandro Caputo <nonedisponibile_AT_gmail.com>
+Date: Thu, 7 Dec 2017 15:54:42 +0100
+Subject: [PATCH] dmenu-xyw
+
+---
+ dmenu.1 | 18 ++++++++++++++++++
+ dmenu.c | 21 +++++++++++++++------
+ 2 files changed, 33 insertions(+), 6 deletions(-)
+
+diff --git a/dmenu.1 b/dmenu.1
+index 9eab758..c3922c9 100644
+--- a/dmenu.1
++++ b/dmenu.1
+_AT_@ -50,6 +50,24 @@ dmenu matches menu items case insensitively.
+ .BI \-l " lines"
+ dmenu lists items vertically, with the given number of lines.
+ .TP
++.BI \-x " xoffset"
++dmenu is placed at this offset measured from the left side of the monitor.
++Can be negative.
++If option
++.B \-m
++is present, the measurement will use the given monitor.
++.TP
++.BI \-y " yoffset"
++dmenu is placed at this offset measured from the top of the monitor. If the
++.B \-b
++option is used, the offset is measured from the bottom. Can be negative.
++If option
++.B \-m
++is present, the measurement will use the given monitor.
++.TP
++.BI \-w " width"
++sets the width of the dmenu window.
++.TP
+ .BI \-m " monitor"
+ dmenu is displayed on the monitor number supplied. Monitor numbers are starting
+ from 0.
+diff --git a/dmenu.c b/dmenu.c
+index eae5685..e607c2a 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -36,6 +36,8 @@ struct item {
+ static char text[BUFSIZ] = "";
+ static char *embed;
+ static int bh, mw, mh;
++static int dmx = 0, dmy = 0; /* put dmenu at these x and y offsets */
++static unsigned int dmw = 0; /* make dmenu this wide */
+ static int inputw = 0, promptw;
+ static int lrpad; /* sum of left and right padding */
+ static size_t cursor;
+_AT_@ -590,9 +592,9 @@ setup(void)
+ if (INTERSECT(x, y, 1, 1, info[i]))
+ break;
+
+- x = info[i].x_org;
+- y = info[i].y_org + (topbar ? 0 : info[i].height - mh);
+- mw = info[i].width;
++ x = info[i].x_org + dmx;
++ y = info[i].y_org + (topbar ? dmy : info[i].height - mh - dmy);
++ mw = (dmw>0 ? dmw : info[i].width);
+ XFree(info);
+ } else
+ #endif
+_AT_@ -600,9 +602,9 @@ setup(void)
+ if (!XGetWindowAttributes(dpy, parentwin, &wa))
+ die("could not get embedding window attributes: 0x%lx",
+ parentwin);
+- x = 0;
+- y = topbar ? 0 : wa.height - mh;
+- mw = wa.width;
++ x = dmx;
++ y = topbar ? dmy : wa.height - mh - dmy;
++ mw = (dmw>0 ? dmw : wa.width);
+ }
+ promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
+ inputw = MIN(inputw, mw/3);
+_AT_@ -640,6 +642,7 @@ static void
+ usage(void)
+ {
+ fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
++ " [-x xoffset] [-y yoffset] [-w width]
"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
", stderr);
+ exit(1);
+ }
+_AT_@ -667,6 +670,12 @@ main(int argc, char *argv[])
+ /* these options take one argument */
+ else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
+ lines = atoi(argv[++i]);
++ else if (!strcmp(argv[i], "-x")) /* window x offset */
++ dmx = atoi(argv[++i]);
++ else if (!strcmp(argv[i], "-y")) /* window y offset (from bottom up if -b) */
++ dmy = atoi(argv[++i]);
++ else if (!strcmp(argv[i], "-w")) /* make dmenu this wide */
++ dmw = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-m"))
+ mon = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
+--
+2.15.1
+
diff --git a/tools.suckless.org/dmenu/patches/xyw.md b/tools.suckless.org/dmenu/patches/xyw.md
index 6caeb687..9e4b2135 100644
--- a/tools.suckless.org/dmenu/patches/xyw.md
+++ b/tools.suckless.org/dmenu/patches/xyw.md
_AT_@ -12,6 +12,7 @@ Download
 --------
 * [dmenu-xyw-4.6.diff](dmenu-xyw-4.6.diff)
 * [dmenu-xyw-20160903-026827f.diff](dmenu-xyw-20160903-026827f.diff)
+* [dmenu-xyw-20171207-f0a5b75.diff](dmenu-xyw-20171207-f0a5b75.diff)
 
 Author
 ------
Received on Thu Dec 07 2017 - 16:00:15 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 07 2017 - 16:00:31 CET