allow to set the statusbar height

This commit is contained in:
Julien Danjou 2007-12-30 18:54:17 +01:00
parent 427858460f
commit 643407b5ea
2 changed files with 11 additions and 4 deletions

View File

@ -375,6 +375,8 @@ config_parse_screen(cfg_t *cfg, int screen)
virtscreen->statusbar->position = virtscreen->statusbar->dposition =
statusbar_get_position_from_str(cfg_getstr(cfg_statusbar, "position"));
virtscreen->statusbar->height = cfg_getint(cfg_statusbar, "height");
create_widgets(cfg_statusbar, virtscreen->statusbar);
/* Layouts */
@ -535,6 +537,7 @@ config_parse(const char *confpatharg)
static cfg_opt_t statusbar_opts[] =
{
CFG_STR((char *) "position", (char *) "top", CFGF_NONE),
CFG_INT((char *) "height", 0, CFGF_NONE),
CFG_SEC((char *) "textbox", widget_textbox_focus_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "taglist", widget_taglist_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
CFG_SEC((char *) "focustitle", widget_textbox_focus_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),

View File

@ -140,11 +140,15 @@ statusbar_init(int screen)
&globalconf.screens[screen].padding);
Statusbar *statusbar = globalconf.screens[screen].statusbar;
statusbar->height = globalconf.screens[screen].font->height * 1.5;
if(statusbar->height <= 0)
{
/* 1.5 as default factor, it fits nice but no one know why */
statusbar->height = globalconf.screens[screen].font->height * 1.5;
for(widget = statusbar->widgets; widget; widget = widget->next)
if(widget->font)
statusbar->height = MAX(statusbar->height, widget->font->height);
for(widget = statusbar->widgets; widget; widget = widget->next)
if(widget->font)
statusbar->height = MAX(statusbar->height, widget->font->height * 1.5);
}
if(statusbar->position == BarRight || statusbar->position == BarLeft)
statusbar->width = area.height;