31 lines
858 B
Plaintext
31 lines
858 B
Plaintext
--- dmenu.c
|
|
+++ dmenu.c
|
|
@@ -647,6 +658,7 @@ setup(void)
|
|
bh = drw->fonts->h + 2;
|
|
lines = MAX(lines, 0);
|
|
mh = (lines + 1) * bh;
|
|
+ promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
|
|
#ifdef XINERAMA
|
|
i = 0;
|
|
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {
|
|
@@ -673,9 +685,16 @@ setup(void)
|
|
if (INTERSECT(x, y, 1, 1, info[i]) != 0)
|
|
break;
|
|
|
|
- x = info[i].x_org;
|
|
- y = info[i].y_org + (topbar ? 0 : info[i].height - mh);
|
|
- mw = info[i].width;
|
|
+ if (centered) {
|
|
+ mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width);
|
|
+ x = info[i].x_org + ((info[i].width - mw) / 2);
|
|
+ y = info[i].y_org + ((info[i].height - mh) / menu_height_ratio);
|
|
+ } else {
|
|
+ x = info[i].x_org;
|
|
+ y = info[i].y_org + (topbar ? 0 : info[i].height - mh);
|
|
+ mw = info[i].width;
|
|
+ }
|
|
+
|
|
XFree(info);
|
|
} else
|
|
#endif
|