aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.mk5
-rw-r--r--dmenu.14
-rw-r--r--main.c16
3 files changed, 22 insertions, 3 deletions
diff --git a/config.mk b/config.mk
index 00fe5a9..1670243 100644
--- a/config.mk
+++ b/config.mk
@@ -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
24CC = cc 29CC = cc
25LD = ${CC} 30LD = ${CC}
diff --git a/dmenu.1 b/dmenu.1
index 694debd..76bb71c 100644
--- a/dmenu.1
+++ b/dmenu.1
@@ -3,6 +3,7 @@
3dmenu \- dynamic menu 3dmenu \- 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
19efficiently. 20efficiently.
20.SS Options 21.SS Options
21.TP 22.TP
23.B \-bottom
24makes dmenu appear at the screen bottom (by default it appears at the screen top).
25.TP
22.B \-font <name> 26.B \-font <name>
23defines the font. 27defines the font.
24.TP 28.TP
diff --git a/main.c b/main.c
index 1c6e57f..7fca45e 100644
--- a/main.c
+++ b/main.c
@@ -330,6 +330,7 @@ DC dc = {0};
330 330
331int 331int
332main(int argc, char *argv[]) { 332main(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),