From a7f81b034294baf012128f840fa743a81cefc61c Mon Sep 17 00:00:00 2001 From: Sebastian LaVine Date: Thu, 15 Dec 2022 15:09:26 -0500 Subject: [PATCH] Use dmx, dmy offsets even when centered I should also probably upstream this as a patch to center[0]. This allows for arguments to be combined, like dmenu -c -y -100 if you want the menu to have a smaller width, be centered on x, and be 100 pixels above the center on y. [0]: https://tools.suckless.org/dmenu/patches/center/ --- dmenu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dmenu.c b/dmenu.c index 6e2282a..114e9ac 100644 --- a/dmenu.c +++ b/dmenu.c @@ -909,8 +909,8 @@ setup(void) if (centered) { mw = MIN(MAX(max_textw(), min_width), info[i].width); - x = info[i].x_org + ((info[i].width - mw) / 2); - y = info[i].y_org + ((info[i].height - mh) / 2); + x = info[i].x_org + ((info[i].width - mw) / 2) + dmx; + y = info[i].y_org + ((info[i].height - mh) / 2) + dmy; } else { x = info[i].x_org + dmx; y = info[i].y_org + (topbar ? dmy : info[i].height - mh - dmy); -- 2.38.5