commit 652b7c12df361a4c5528240e84304814e63494fc
parent 44271902f7fd534d75eaa60752ac4760c33750dc
Author: Luke Jones <luke.jones.2567@gmail.com>
Date: Tue, 13 Oct 2026 11:42:17 +0100
patch: xyw (suckless)
Diffstat:
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/dmenu.c b/dmenu.c
@@ -38,6 +38,9 @@ struct item {
static char text[BUFSIZ] = "";
static char *embed;
static int bh, mw, mh;
+static int dmx = 0;
+static int dmy = 0;
+static unsigned int dmw = 0;
static int inputw = 0, promptw;
static int lrpad; /* sum of left and right padding */
static size_t cursor;
@@ -753,9 +756,9 @@ setup(void)
if (i >= n)
i = 0;
- 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
@@ -763,9 +766,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 = mw / 3; /* input width: ~33% of monitor width */
@@ -834,6 +837,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 */