diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-06-11 22:52:50 +0200 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-06-11 22:52:50 +0200 |
commit | fcfcfedfe45d3a004d622b0660afe42b92a9bd6f (patch) | |
tree | 95b1460340ea543daa6bd8d70ea886c0e5a8a34b /dmenu.c | |
parent | Added patch list (diff) | |
download | dmenu-fcfcfedfe45d3a004d622b0660afe42b92a9bd6f.tar.gz dmenu-fcfcfedfe45d3a004d622b0660afe42b92a9bd6f.tar.bz2 dmenu-fcfcfedfe45d3a004d622b0660afe42b92a9bd6f.zip |
Added height option patch [Patch]
Diffstat (limited to 'dmenu.c')
-rw-r--r-- | dmenu.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/dmenu.c b/dmenu.c index 65f25ce..b9a5a09 100644 --- a/dmenu.c +++ b/dmenu.c @@ -131,7 +131,7 @@ drawmenu(void) { unsigned int curpos; struct item *item; - int x = 0, y = 0, w; + int x = 0, y = 0, fh = drw->fonts->h, w; drw_setscheme(drw, scheme[SchemeNorm]); drw_rect(drw, 0, 0, mw, mh, 1, 1); @@ -148,7 +148,7 @@ drawmenu(void) curpos = TEXTW(text) - TEXTW(&text[cursor]); if ((curpos += lrpad / 2 - 1) < w) { drw_setscheme(drw, scheme[SchemeNorm]); - drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0); + drw_rect(drw, x + curpos, 2 + (bh-fh)/2, 2, fh - 4, 1, 0); } if (lines > 0) { @@ -609,6 +609,7 @@ setup(void) /* calculate menu geometry */ bh = drw->fonts->h + 2; + bh = MAX(bh,lineheight); /* make a menu line AT LEAST 'lineheight' tall */ lines = MAX(lines, 0); mh = (lines + 1) * bh; #ifdef XINERAMA @@ -690,6 +691,7 @@ static void usage(void) { fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" + " [-h height]\n" " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr); exit(1); } @@ -723,6 +725,10 @@ main(int argc, char *argv[]) prompt = argv[++i]; else if (!strcmp(argv[i], "-fn")) /* font or font set */ fonts[0] = argv[++i]; + else if(!strcmp(argv[i], "-h")) { /* minimum height of one menu line */ + lineheight = atoi(argv[++i]); + lineheight = MAX(lineheight,8); /* reasonable default in case of value too small/negative */ + } else if (!strcmp(argv[i], "-nb")) /* normal background color */ colors[SchemeNorm][ColBg] = argv[++i]; else if (!strcmp(argv[i], "-nf")) /* normal foreground color */ |