diff options
| -rw-r--r-- | config.mk | 5 | ||||
| -rw-r--r-- | dmenu.1 | 4 | ||||
| -rw-r--r-- | main.c | 16 |
3 files changed, 22 insertions, 3 deletions
| @@ -20,6 +20,11 @@ LDFLAGS = ${LIBS} | |||
| 20 | #CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" | 20 | #CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" |
| 21 | #LDFLAGS = -g ${LIBS} | 21 | #LDFLAGS = -g ${LIBS} |
| 22 | 22 | ||
| 23 | # Solaris | ||
| 24 | #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" | ||
| 25 | #LDFLAGS = ${LIBS} | ||
| 26 | #CFLAGS += -xtarget=ultra | ||
| 27 | |||
| 23 | # compiler and linker | 28 | # compiler and linker |
| 24 | CC = cc | 29 | CC = cc |
| 25 | LD = ${CC} | 30 | LD = ${CC} |
| @@ -3,6 +3,7 @@ | |||
| 3 | dmenu \- dynamic menu | 3 | dmenu \- dynamic menu |
| 4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
| 5 | .B dmenu | 5 | .B dmenu |
| 6 | .RB [ \-bottom ] | ||
| 6 | .RB [ \-font " <name>"] | 7 | .RB [ \-font " <name>"] |
| 7 | .RB [ \-normbg " <color>"] | 8 | .RB [ \-normbg " <color>"] |
| 8 | .RB [ \-normfg " <color>"] | 9 | .RB [ \-normfg " <color>"] |
| @@ -19,6 +20,9 @@ It manages huge amounts (up to 10.000 and more) of user defined menu items | |||
| 19 | efficiently. | 20 | efficiently. |
| 20 | .SS Options | 21 | .SS Options |
| 21 | .TP | 22 | .TP |
| 23 | .B \-bottom | ||
| 24 | makes dmenu appear at the screen bottom (by default it appears at the screen top). | ||
| 25 | .TP | ||
| 22 | .B \-font <name> | 26 | .B \-font <name> |
| 23 | defines the font. | 27 | defines the font. |
| 24 | .TP | 28 | .TP |
| @@ -330,6 +330,7 @@ DC dc = {0}; | |||
| 330 | 330 | ||
| 331 | int | 331 | int |
| 332 | main(int argc, char *argv[]) { | 332 | main(int argc, char *argv[]) { |
| 333 | Bool bottom = False; | ||
| 333 | char *font = FONT; | 334 | char *font = FONT; |
| 334 | char *maxname; | 335 | char *maxname; |
| 335 | char *normbg = NORMBGCOLOR; | 336 | char *normbg = NORMBGCOLOR; |
| @@ -347,7 +348,10 @@ main(int argc, char *argv[]) { | |||
| 347 | timeout.tv_sec = 3; | 348 | timeout.tv_sec = 3; |
| 348 | /* command line args */ | 349 | /* command line args */ |
| 349 | for(i = 1; i < argc; i++) | 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 | if(++i < argc) font = argv[i]; | 355 | if(++i < argc) font = argv[i]; |
| 352 | } | 356 | } |
| 353 | else if(!strncmp(argv[i], "-normbg", 8)) { | 357 | else if(!strncmp(argv[i], "-normbg", 8)) { |
| @@ -373,7 +377,8 @@ main(int argc, char *argv[]) { | |||
| 373 | exit(EXIT_SUCCESS); | 377 | exit(EXIT_SUCCESS); |
| 374 | } | 378 | } |
| 375 | else | 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 | setlocale(LC_CTYPE, ""); | 382 | setlocale(LC_CTYPE, ""); |
| 378 | dpy = XOpenDisplay(0); | 383 | dpy = XOpenDisplay(0); |
| 379 | if(!dpy) | 384 | if(!dpy) |
| @@ -406,7 +411,12 @@ main(int argc, char *argv[]) { | |||
| 406 | wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask; | 411 | wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask; |
| 407 | mx = my = 0; | 412 | mx = my = 0; |
| 408 | mw = DisplayWidth(dpy, screen); | 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 | win = XCreateWindow(dpy, root, mx, my, mw, mh, 0, | 420 | win = XCreateWindow(dpy, root, mx, my, mw, mh, 0, |
| 411 | DefaultDepth(dpy, screen), CopyFromParent, | 421 | DefaultDepth(dpy, screen), CopyFromParent, |
| 412 | DefaultVisual(dpy, screen), | 422 | DefaultVisual(dpy, screen), |
