mirror of git://git.suckless.org/dmenu
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
This commit is contained in:
parent
201b056e39
commit
3438af001a
|
@ -20,6 +20,11 @@ LDFLAGS = ${LIBS}
|
||||||
#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
|
#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
|
||||||
#LDFLAGS = -g ${LIBS}
|
#LDFLAGS = -g ${LIBS}
|
||||||
|
|
||||||
|
# Solaris
|
||||||
|
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
|
||||||
|
#LDFLAGS = ${LIBS}
|
||||||
|
#CFLAGS += -xtarget=ultra
|
||||||
|
|
||||||
# compiler and linker
|
# compiler and linker
|
||||||
CC = cc
|
CC = cc
|
||||||
LD = ${CC}
|
LD = ${CC}
|
||||||
|
|
4
dmenu.1
4
dmenu.1
|
@ -3,6 +3,7 @@
|
||||||
dmenu \- dynamic menu
|
dmenu \- dynamic menu
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B dmenu
|
.B dmenu
|
||||||
|
.RB [ \-bottom ]
|
||||||
.RB [ \-font " <name>"]
|
.RB [ \-font " <name>"]
|
||||||
.RB [ \-normbg " <color>"]
|
.RB [ \-normbg " <color>"]
|
||||||
.RB [ \-normfg " <color>"]
|
.RB [ \-normfg " <color>"]
|
||||||
|
@ -19,6 +20,9 @@ It manages huge amounts (up to 10.000 and more) of user defined menu items
|
||||||
efficiently.
|
efficiently.
|
||||||
.SS Options
|
.SS Options
|
||||||
.TP
|
.TP
|
||||||
|
.B \-bottom
|
||||||
|
makes dmenu appear at the screen bottom (by default it appears at the screen top).
|
||||||
|
.TP
|
||||||
.B \-font <name>
|
.B \-font <name>
|
||||||
defines the font.
|
defines the font.
|
||||||
.TP
|
.TP
|
||||||
|
|
14
main.c
14
main.c
|
@ -330,6 +330,7 @@ DC dc = {0};
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
|
Bool bottom = False;
|
||||||
char *font = FONT;
|
char *font = FONT;
|
||||||
char *maxname;
|
char *maxname;
|
||||||
char *normbg = NORMBGCOLOR;
|
char *normbg = NORMBGCOLOR;
|
||||||
|
@ -347,7 +348,10 @@ main(int argc, char *argv[]) {
|
||||||
timeout.tv_sec = 3;
|
timeout.tv_sec = 3;
|
||||||
/* command line args */
|
/* command line args */
|
||||||
for(i = 1; i < argc; i++)
|
for(i = 1; i < argc; i++)
|
||||||
if(!strncmp(argv[i], "-font", 6)) {
|
if(!strncmp(argv[i], "-bottom", 8)) {
|
||||||
|
bottom = True;
|
||||||
|
}
|
||||||
|
else if(!strncmp(argv[i], "-font", 6)) {
|
||||||
if(++i < argc) font = argv[i];
|
if(++i < argc) font = argv[i];
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[i], "-normbg", 8)) {
|
else if(!strncmp(argv[i], "-normbg", 8)) {
|
||||||
|
@ -373,7 +377,8 @@ main(int argc, char *argv[]) {
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
eprint("usage: dmenu [-font <name>] [-{norm,sel}{bg,fg} <color>] [-p <prompt>] [-t <seconds>] [-v]\n", stdout);
|
eprint("usage: dmenu [-bottom] [-font <name>] [-{norm,sel}{bg,fg} <color>]\n"
|
||||||
|
" [-p <prompt>] [-t <seconds>] [-v]\n", stdout);
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
dpy = XOpenDisplay(0);
|
dpy = XOpenDisplay(0);
|
||||||
if(!dpy)
|
if(!dpy)
|
||||||
|
@ -406,6 +411,11 @@ main(int argc, char *argv[]) {
|
||||||
wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask;
|
wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask;
|
||||||
mx = my = 0;
|
mx = my = 0;
|
||||||
mw = DisplayWidth(dpy, screen);
|
mw = DisplayWidth(dpy, screen);
|
||||||
|
if(bottom) {
|
||||||
|
mh = dc.font.ascent + dc.font.descent + 3; // match wmii
|
||||||
|
my = DisplayHeight(dpy, screen) - mh;
|
||||||
|
}
|
||||||
|
else
|
||||||
mh = dc.font.height + 2;
|
mh = dc.font.height + 2;
|
||||||
win = XCreateWindow(dpy, root, mx, my, mw, mh, 0,
|
win = XCreateWindow(dpy, root, mx, my, mw, mh, 0,
|
||||||
DefaultDepth(dpy, screen), CopyFromParent,
|
DefaultDepth(dpy, screen), CopyFromParent,
|
||||||
|
|
Loading…
Reference in New Issue