--- dmenu.c +++ dmenu.c @@ -644,11 +654,10 @@ 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; + mw = MIN(MAX(max_textw() + promptw, 100), wa.width); + x = (wa.width - mw) / 2; + y = (wa.height - mh) / 2; } - promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; inputw = MIN(inputw, mw/3); match();