Infobar/Conf: Add bar { height = x } option (requested by ecc___) to set infobars height.

This commit is contained in:
Martin Duquesnoy 2009-06-06 15:08:06 +02:00
parent fbfc1629f4
commit 71471902f0
5 changed files with 9 additions and 4 deletions

View File

@ -139,9 +139,11 @@ void
conf_bar_section(cfg_t *cfg_b)
{
conf.border.bar = cfg_getbool(cfg_b, "border");
conf.bars.height = cfg_getint(cfg_b, "height");
conf.colors.bar = getcolor(alias_to_str(cfg_getstr(cfg_b, "bg")));
conf.colors.text = _strdup(alias_to_str(cfg_getstr(cfg_b, "fg")));
if((conf.bars.nmouse = cfg_size(cfg_b, "mouse")))
{
conf.bars.mouse = emalloc(conf.bars.nmouse, sizeof(MouseBinding));

View File

@ -61,6 +61,7 @@ cfg_opt_t bar_opts[] =
{
CFG_STR("bg", "#090909", CFGF_NONE),
CFG_STR("fg", "#6289A1", CFGF_NONE),
CFG_INT("height", -1, CFGF_NONE),
CFG_BOOL("border", cfg_false, CFGF_NONE),
CFG_SEC("mouse", mouse_button_opts, CFGF_MULTI),
CFG_END()

View File

@ -113,7 +113,7 @@ infobar_draw(int sc)
infobar_draw_taglist(sc);
infobar_draw_layout(sc);
barwin_refresh_color(infobar[sc].bar);
barwin_draw_text(infobar[sc].bar, (sgeo[sc].width - SHADH) - textw(statustext), font->height, statustext);
barwin_draw_text(infobar[sc].bar, (sgeo[sc].width - SHADH) - textw(statustext), FHINFOBAR, statustext);
return;
}
@ -127,7 +127,7 @@ infobar_draw_layout(int sc)
barwin_resize(infobar[sc].layout_button, textw(tags[sc][seltag[sc]].layout.symbol) + PAD, infobar[sc].geo.height);
barwin_refresh_color(infobar[sc].layout_button);
if(tags[sc][seltag[sc]].layout.symbol)
barwin_draw_text(infobar[sc].layout_button, PAD / 2, font->height, tags[sc][seltag[sc]].layout.symbol);
barwin_draw_text(infobar[sc].layout_button, PAD / 2, FHINFOBAR, tags[sc][seltag[sc]].layout.symbol);
return;
}
@ -157,7 +157,7 @@ infobar_draw_taglist(int sc)
}
}
if(tags[sc][i].name)
barwin_draw_text(infobar[sc].tags[i], PAD / 2, font->height, tags[sc][i].name);
barwin_draw_text(infobar[sc].tags[i], PAD / 2, FHINFOBAR, tags[sc][i].name);
}
return;

View File

@ -297,6 +297,7 @@ typedef struct
} colors;
struct
{
int height;
MouseBinding *mouse;
int nmouse;
} bars;

View File

@ -74,7 +74,8 @@
#define MAXH DisplayHeight(dpy, DefaultScreen(dpy))
#define MAXW DisplayWidth(dpy, DefaultScreen(dpy))
#define ATOM(a) XInternAtom(dpy, (a), False)
#define INFOBARH (font->height * 1.5)
#define INFOBARH ((conf.bars.height != -1) ? conf.bars.height : (font->height * 1.5))
#define FHINFOBAR ((font->height - font->descent) + (INFOBARH - font->height) / 2)
#define SHADH 1
#define SHADC 0x000000 /* 'Cause i don't know how darken a color yet */
#define BORDH conf.client.borderheight