> It would be more sensible to have a single '-g' flag, for geometry, > which would take an X geometry string. I did write a patch a while > back which did this, but I don't know where I put it. I also didn't > find it at all useful, and some of the code was a bit ugly. What would > be the use case for this?
diff -r 6341d6b4c23f config.mk --- a/config.mk Mon Oct 17 10:22:23 2011 +0100 +++ b/config.mk Wed Oct 19 14:17:18 2011 +0100 @@ -18,7 +18,7 @@ # flags CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -CFLAGS = -ansi -pedantic -Wall -Os ${INCS} ${CPPFLAGS} +CFLAGS = -ansi -pedantic -Wall -Wextra -Os ${INCS} ${CPPFLAGS} LDFLAGS = -s ${LIBS} # compiler and linker diff -r 6341d6b4c23f dmenu.c --- a/dmenu.c Mon Oct 17 10:22:23 2011 +0100 +++ b/dmenu.c Wed Oct 19 14:17:18 2011 +0100 @@ -39,15 +39,16 @@ static void usage(void); static char text[BUFSIZ] = ""; -static int bh, mw, mh; static int inputw, promptw; static size_t cursor = 0; static const char *font = NULL; +static const char *geom = NULL; static const char *prompt = NULL; static const char *normbgcolor = "#cccccc"; static const char *normfgcolor = "#000000"; static const char *selbgcolor = "#0066ff"; static const char *selfgcolor = "#ffffff"; +static unsigned int bh, mw, mh; static unsigned int lines = 0; static unsigned long normcol[ColLast]; static unsigned long selcol[ColLast]; @@ -85,6 +86,8 @@ else if(i+1 == argc) usage(); /* double flags */ + else if(!strcmp(argv[i], "-g")) + geom = argv[++i]; else if(!strcmp(argv[i], "-l")) lines = atoi(argv[++i]); else if(!strcmp(argv[i], "-p")) @@ -511,8 +514,12 @@ bh = dc->font.height + 2; lines = MAX(lines, 0); mh = (lines + 1) * bh; + if(geom) { + XParseGeometry(geom, &x, &y, &mw, &mh); + lines = (mh / bh)-1; + } #ifdef XINERAMA - if((info = XineramaQueryScreens(dc->dpy, &n))) { + else if((info = XineramaQueryScreens(dc->dpy, &n))) { int i, di; unsigned int du; Window w, dw; @@ -531,9 +538,8 @@ mw = info[i].width; XFree(info); } - else #endif - { + else { x = 0; y = topbar ? 0 : DisplayHeight(dc->dpy, screen) - mh; mw = DisplayWidth(dc->dpy, screen); > On 2 December 2011 20:12, Bjartur Thorlacius <svartma...@gmail.com> wrote: > > Why choose window placement and dimensions at exec, instead of letting > > the window manager handle the issue? Just set _NET_WM_WINDOW_TYPE to > > _NET_WM_WINDOW_TYPE_DIALOG and spend engineering time ranting about > > WM_TRANSIENT_FOR, modality and modularity instead. > > DIALOG wouldn't work, because dmenu would be given silly decorations > &c. I think if we were to go down this route we'd have to go with DOCK > and use _NET_WM_STRUT_PARTIAL. Not sure that's a good idea, though. > > > dmenu's override-redirect flag has always annoyed me, as well as > > grabbing the whole keyboard rendering it temporarily unusable for > > anything but typing text into dmenu or escaping out of it. > > I would think that moving one's mouse unfocusing dmenu would be > annoying. But if someone were to write a patch I would try it out. Why would you move the mouse and not expect it to refocus things? Esp. since this is how it works everywhere else? > > Thanks, > cls > -- sic dicit magister P University of Toronto / Fordham University Collins Hall B06; Office Hours TF10-12 http://individual.utoronto.ca/peterjh gpg --keyserver pgp.mit.edu --recv-keys E0DBD3D6