[wiki] [sites] [dmenu][PATCH] Options for position and width || Xarchus

From: <git_AT_suckless.org>
Date: Mon, 23 Nov 2015 13:01:43 +0100

commit a132927e9f824c0689f9e1ab8acdad744e9b57b7
Author: Xarchus <xarchus_AT_comcast.net>
Date: Mon Nov 23 03:56:40 2015 -0800

    [dmenu][PATCH] Options for position and width
    
    - add -x and -y options to set window position relative to the upper
      left of the target monitor (0 if one is not supplied with -m)
    - if option -b is used, the y offset is computed from the bottom
    - add -w option to set the window width

diff --git a/tools.suckless.org/dmenu/patches/dmenu-4.6-xyw.diff b/tools.suckless.org/dmenu/patches/dmenu-4.6-xyw.diff
new file mode 100644
index 0000000..5e1ea47
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/dmenu-4.6-xyw.diff
_AT_@ -0,0 +1,87 @@
+diff --git a/dmenu.1 b/dmenu.1
+index d3ab805..5301910 100644
+--- a/dmenu.1
++++ b/dmenu.1
+_AT_@ -51,6 +51,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 a07f8e3..9e0c51c 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -37,6 +37,9 @@ struct item {
+ static char text[BUFSIZ] = "";
+ static int bh, mw, mh;
+ static int sw, sh; /* X display screen geometry width, height */
++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, promptw;
+ static size_t cursor;
+ static struct item *items = NULL;
+_AT_@ -571,16 +574,16 @@ 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
+ {
+- x = 0;
+- y = topbar ? 0 : sh - mh;
+- mw = sw;
++ x = dmx;
++ y = topbar ? dmy : sh - mh - dmy;
++ mw = (dmw>0 ? dmw : sw);
+ }
+ promptw = (prompt && *prompt) ? TEXTW(prompt) : 0;
+ inputw = MIN(inputw, mw/3);
+_AT_@ -609,6 +612,7 @@ static void
+ usage(void)
+ {
+ fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font] [-m monitor]
"
++ " [-x xoffset] [-y yoffset] [-w width]
"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-v]
", stderr);
+ exit(1);
+ }
+_AT_@ -635,6 +639,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 */
diff --git a/tools.suckless.org/dmenu/patches/xyw.md b/tools.suckless.org/dmenu/patches/xyw.md
new file mode 100644
index 0000000..e1b58eb
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/xyw.md
_AT_@ -0,0 +1,19 @@
+Position and width
+==================
+
+The patch adds options for setting window position and width.
+
+* The '-x' and '-y' options set the window position on the target monitor (0 if one is not supplied with '-m')
+* If option '-b' is used, the y offset is computed from the bottom
+* The '-x' and '-y' accept negative values
+* The '-w' option sets the window width
+
+Download
+--------
+* [dmenu-4.6-xyw.diff](dmenu-4.6-xyw.diff)
+
+Author
+------
+* Xarchus
+
+
Received on Mon Nov 23 2015 - 13:01:43 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 23 2015 - 13:12:13 CET