sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1cb61f172c7088556e608394e7dad4474f2ed380
parent 86ac1f79a7050b328fa3d3d99b3bd599663e511d
Author: Jonathon Fernyhough <jonathon@manjaro.org>
Date:   Sat,  6 Jan 2018 19:19:55 +0000

[dmenu][lineheight] Update for 4.7

Diffstat:
Atools.suckless.org/dmenu/patches/dmenu-lineheight-4.7.diff | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtools.suckless.org/dmenu/patches/line-height.md | 6++++--
2 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/tools.suckless.org/dmenu/patches/dmenu-lineheight-4.7.diff b/tools.suckless.org/dmenu/patches/dmenu-lineheight-4.7.diff @@ -0,0 +1,76 @@ +diff --git a/config.def.h b/config.def.h +index a9122f7..6d936b7 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -16,4 +16,5 @@ + /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ + static unsigned int lines = 0; ++static unsigned int lineheight = 0; /* -h option; minimum height of a menu line */ + + /* +diff --git a/dmenu.1 b/dmenu.1 +index d3ab805..9fe4434 100644 +--- a/dmenu.1 ++++ b/dmenu.1 +@@ -50,6 +50,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. +diff --git a/dmenu.c b/dmenu.c +index a07f8e3..25832a7 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -130,7 +130,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); +@@ -145,9 +145,9 @@ drawmenu(void) + drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0); + + drw_font_getexts(drw->fonts, text, cursor, &curpos, NULL); + 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) { +@@ -676,7 +676,8 @@ setup(void) + utf8 = XInternAtom(dpy, "UTF8_STRING", False); + + /* 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 +@@ -754,6 +755,7 @@ setup(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); + } +@@ -787,6 +789,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 */ + normbgcolor = argv[++i]; + else if (!strcmp(argv[i], "-nf")) /* normal foreground color */ diff --git a/tools.suckless.org/dmenu/patches/line-height.md b/tools.suckless.org/dmenu/patches/line-height.md @@ -1,7 +1,7 @@ Line height =========== -The patch adds a '-lh' option, which sets the minimum height of a dmenu line. +The patch adds a '-h' option, which sets the minimum height of a dmenu line. This helps integrate dmenu with other UI elements that require a particular vertical size. @@ -18,7 +18,7 @@ shorter and the panel is visible from under the dmenu bar. The appearance can be even more distracting when using similar colors for background and selections. -With the option added by this patch, dmenu can be launched with a '-lh 24', +With the option added by this patch, dmenu can be launched with a '-h 24', thus completely covering the panel, as shown below: ->[![Screenshot dmenu with line height patch](dmenu-line-height.png)](dmenu-line-height.png)<- @@ -27,8 +27,10 @@ The line height value is also used when dmenu is used in 'vertical' mode ('-l' o Download -------- +* [dmenu-lineheight-4.7.diff](dmenu-lineheight-4.7.diff) * [dmenu-lineheight-4.6.diff](dmenu-lineheight-4.6.diff) Author ------ * Xarchus +* Jonathon Fernyhough <jonathon at manjaro_dot_org> (4.7)