[wiki] [sites] [dmenu][patch][xyw] changes to avoid conflict with '-w windowid' || Alex Cole
commit 26bac1afdbbf17077c97d60a2995bf2e3546dc52
Author: Alex Cole <ajzcole_AT_airmail.cc>
Date: Sun Oct 4 22:48:05 2020 +1300
[dmenu][patch][xyw] changes to avoid conflict with '-w windowid'
diff --git a/tools.suckless.org/dmenu/patches/xyw/dmenu-xyw-5.0.diff b/tools.suckless.org/dmenu/patches/xyw/dmenu-xyw-5.0.diff
new file mode 100644
index 00000000..1925835f
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/xyw/dmenu-xyw-5.0.diff
_AT_@ -0,0 +1,91 @@
+diff --git a/dmenu.1 b/dmenu.1
+index d3ab805..5301910 100644
+--- a/dmenu.1
++++ b/dmenu.1
+_AT_@ -53,6 +53,24 @@ dmenu matches menu items case insensitively.
+ .BI \-h " height"
+ dmenu uses a menu line of at least 'height' pixels tall, but no less than 8.
+ .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 \-z " 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 a07f8e3..9e0c51c 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -36,6 +36,9 @@ struct item {
+ static char text[BUFSIZ] = "";
+ static char *embed;
+ static int bh, mw, mh;
++static int dmx = 0; /* put dmenu at this x offset */
++static int dmy = 0; /* put dmenu at this y offset (measured from the bottom if topbar is 0) */
++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_@ -705,19 +708,19 @@ 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
+ {
+ 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) : 0;
+ inputw = MIN(inputw, mw/3);
+_AT_@ -755,7 +758,7 @@ static void
+ usage(void)
+ {
+ fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
+- " [-h height]
"
++ " [-h height] [-x xoffset] [-y yoffset] [-z width]
"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
", stderr);
+ exit(1);
+ }
+_AT_@ -783,6 +786,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], "-z")) /* 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 */
diff --git a/tools.suckless.org/dmenu/patches/xyw/index.md b/tools.suckless.org/dmenu/patches/xyw/index.md
index 889cc046..2fcbb33b 100644
--- a/tools.suckless.org/dmenu/patches/xyw/index.md
+++ b/tools.suckless.org/dmenu/patches/xyw/index.md
_AT_@ -8,8 +8,12 @@ The patch adds options for setting window position and width.
* The '-x' and '-y' accept negative values
* The '-w' option sets the window width
+Please note that for the 5.0 version, the width parameter is '-z' to avoid conflict with '-w windowid'.
+If this change is not desired, the 4.7 version applies perfectly, but '-w windowid' will not work.
+
Download
--------
+* [dmenu-xyw-5.0.diff](dmenu-xyw-5.0.diff)
* [dmenu-xyw-4.7.diff](dmenu-xyw-4.7.diff)
* [dmenu-xyw-20171207-f0a5b75.diff](dmenu-xyw-20171207-f0a5b75.diff)
* [dmenu-xyw-20160903-026827f.diff](dmenu-xyw-20160903-026827f.diff)
_AT_@ -19,4 +23,4 @@ Author
------
* Xarchus
* Jonathon Fernyhough (jonathon at manjaro-dot-org) (4.7 rewrite)
-
+* Alex Cole <ajzcole_AT_airmail.cc> (changes in the 5.0 version)
Received on Sun Oct 04 2020 - 11:49:04 CEST
This archive was generated by hypermail 2.3.0
: Sun Oct 04 2020 - 12:00:45 CEST