applied Stefan Tibus' sun patch, added -bottom option to dmenu which makes it appear in the bottom (for wmii compliance), slightly modified version than the patch proposed by Stefan Tibus 3438af00
arg@mig29 · 2006-12-18 12:52 3 file(s) · +22 −3
config.mk +5 −0
20 20
#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
21 21
#LDFLAGS = -g ${LIBS}
22 22
23 +
# Solaris
24 +
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
25 +
#LDFLAGS = ${LIBS}
26 +
#CFLAGS += -xtarget=ultra
27 +
23 28
# compiler and linker
24 29
CC = cc
25 30
LD = ${CC}
dmenu.1 +4 −0
3 3
dmenu \- dynamic menu
4 4
.SH SYNOPSIS
5 5
.B dmenu
6 +
.RB [ \-bottom ]
6 7
.RB [ \-font " <name>"]
7 8
.RB [ \-normbg " <color>"]
8 9
.RB [ \-normfg " <color>"]
18 19
It manages huge amounts (up to 10.000 and more) of user defined menu items
19 20
efficiently.
20 21
.SS Options
22 +
.TP
23 +
.B \-bottom
24 +
makes dmenu appear at the screen bottom (by default it appears at the screen top).
21 25
.TP
22 26
.B \-font <name>
23 27
defines the font.
main.c +13 −3
330 330
331 331
int
332 332
main(int argc, char *argv[]) {
333 +
	Bool bottom = False;
333 334
	char *font = FONT;
334 335
	char *maxname;
335 336
	char *normbg = NORMBGCOLOR;
347 348
	timeout.tv_sec = 3;
348 349
	/* command line args */
349 350
	for(i = 1; i < argc; i++)
350 -
		if(!strncmp(argv[i], "-font", 6)) {
351 +
		if(!strncmp(argv[i], "-bottom", 8)) {
352 +
			bottom = True;
353 +
		}
354 +
		else if(!strncmp(argv[i], "-font", 6)) {
351 355
			if(++i < argc) font = argv[i];
352 356
		}
353 357
		else if(!strncmp(argv[i], "-normbg", 8)) {
373 377
			exit(EXIT_SUCCESS);
374 378
		}
375 379
		else
376 -
			eprint("usage: dmenu [-font <name>] [-{norm,sel}{bg,fg} <color>] [-p <prompt>] [-t <seconds>] [-v]\n", stdout);
380 +
			eprint("usage: dmenu [-bottom] [-font <name>] [-{norm,sel}{bg,fg} <color>]\n"
381 +
				"             [-p <prompt>] [-t <seconds>] [-v]\n", stdout);
377 382
	setlocale(LC_CTYPE, "");
378 383
	dpy = XOpenDisplay(0);
379 384
	if(!dpy)
406 411
	wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask;
407 412
	mx = my = 0;
408 413
	mw = DisplayWidth(dpy, screen);
409 -
	mh = dc.font.height + 2;
414 +
	if(bottom) {
415 +
		mh = dc.font.ascent + dc.font.descent + 3; // match wmii
416 +
		my = DisplayHeight(dpy, screen) - mh;
417 +
	}
418 +
	else
419 +
		mh = dc.font.height + 2;
410 420
	win = XCreateWindow(dpy, root, mx, my, mw, mh, 0,
411 421
			DefaultDepth(dpy, screen), CopyFromParent,
412 422
			DefaultVisual(dpy, screen),