@@ 5,6 5,9 @@ static int topbar = 1; /* -b option; if 0, dmenu appears a
static int colorprompt = 1; /* -p option; if 1, prompt uses SchemeSel, otherwise SchemeNorm */
static int centered = 0; /* -c option; centers dmenu on screen */
static int min_width = 500; /* minimum width when centered */
+static unsigned int lineheight = 0;
+static unsigned int min_lineheight = 8;
+
/* -fn option overrides fonts[0]; default X11 font or font set */
static const char *defaultfonts[] = {
"monospace:size=10"
@@ 20,6 20,8 @@ dmenu \- dynamic menu
.IR color ]
.RB [ \-sf
.IR color ]
.RB [ \-H
.IR height ]
.RB [ \-w
.IR windowid ]
.RB [ \-idx
@@ 56,6 58,9 @@ dmenu matches menu items case insensitively.
.BI \-l " lines"
dmenu lists items vertically, with the given number of lines.
.TP
.BI \-H " height"
dmenu uses a menu line of at least 'height' pixels tall, but no less than 8
.TP
.BI \-m " monitor"
dmenu is displayed on the monitor number supplied. Monitor numbers are starting
from 0.
@@ 208,7 208,7 @@ drawmenu(void)
{
static int curpos, oldcurlen;
struct item *item;
int x = 0, y = 0, w;
int x = 0, y = 0, fh = drw->fonts->h, w;
int curlen, rcurlen;
drw_setscheme(drw, scheme[SchemeNorm]);
@@ 238,7 238,7 @@ drawmenu(void)
drw_setscheme(drw, scheme[SchemeNorm]);
drw_text_align(drw, x, 0, curpos, bh, text, cursor, AlignR);
drw_text_align(drw, x + curpos, 0, w - curpos - TEXTW(numbers), bh, text + cursor, strlen(text) - cursor, AlignL);
drw_rect(drw, x + curpos - 1, 2, 2, bh - 4, 1, 0);
drw_rect(drw, x + curpos - 1, 2 + (bh - fh) / 2, 2, fh - 4, 1, 0);
if (lines > 0) {
/* draw vertical list */
@@ 937,6 937,7 @@ setup(void)
/* calculate menu geometry */
bh = drw->fonts->h + 2;
bh = MAX(bh, lineheight);
lines = MAX(lines, 0);
mh = (lines + 1) * bh;
promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
@@ 1058,7 1059,7 @@ setup(void)
static void
usage(void)
{
fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
fputs("usage: dmenu [-bfiv] [-l lines] [-H height] [-p prompt] [-fn font] [-m monitor]\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
exit(1);
}
@@ 1134,6 1135,10 @@ main(int argc, char *argv[])
/* these options take one argument */
else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
lines = atoi(argv[++i]);
else if (!strcmp(argv[i], "-H")) {
lineheight = atoi(argv[++i]);
lineheight = MAX(lineheight, min_lineheight);
}
else if (!strcmp(argv[i], "-m"))
mon = atoi(argv[++i]);
else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */