From 71471902f0a9b97b6827cd29d4b75b574383da74 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Sat, 6 Jun 2009 15:08:06 +0200 Subject: [PATCH] Infobar/Conf: Add bar { height = x } option (requested by ecc___) to set infobars height. --- src/config.c | 2 ++ src/config_struct.h | 1 + src/infobar.c | 6 +++--- src/structs.h | 1 + src/wmfs.h | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/config.c b/src/config.c index 185f633..fa22835 100644 --- a/src/config.c +++ b/src/config.c @@ -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)); diff --git a/src/config_struct.h b/src/config_struct.h index cb489c5..4143430 100644 --- a/src/config_struct.h +++ b/src/config_struct.h @@ -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() diff --git a/src/infobar.c b/src/infobar.c index a1f1f39..2d0690e 100644 --- a/src/infobar.c +++ b/src/infobar.c @@ -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; diff --git a/src/structs.h b/src/structs.h index eec4f39..06bed57 100644 --- a/src/structs.h +++ b/src/structs.h @@ -297,6 +297,7 @@ typedef struct } colors; struct { + int height; MouseBinding *mouse; int nmouse; } bars; diff --git a/src/wmfs.h b/src/wmfs.h index eea0dc2..b58c1fa 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -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