diff --git a/src/bar.c b/src/bar.c index df63ec9..f1ca4cd 100644 --- a/src/bar.c +++ b/src/bar.c @@ -95,6 +95,8 @@ void bar_refresh_color(BarWindow *bw) { draw_rectangle(bw->dr, 0, 0, bw->w, bw->h, bw->color); + if(bw->bord) + XSetWindowBorder(dpy, bw->win, bw->color); return; } diff --git a/src/config.c b/src/config.c index 73a64ac..9fa65f9 100644 --- a/src/config.c +++ b/src/config.c @@ -206,7 +206,8 @@ init_conf(void) { CFG_STR("position", "top", CFGF_NONE), CFG_INT("height", 0, CFGF_NONE), - CFG_STR("bg", "#090909", CFGF_NONE), + CFG_STR("bg_normal", "#090909", CFGF_NONE), + CFG_STR("bg_focus", "#090909", CFGF_NONE), CFG_STR("fg_focus", "#FFFFFF", CFGF_NONE), CFG_STR("fg_normal", "#FFFFFF", CFGF_NONE), CFG_STR("text_align", "left", CFGF_NONE), @@ -387,7 +388,8 @@ init_conf(void) conf.titlebar.height = cfg_getint(cfg_titlebar, "height"); conf.titlebar.exist = conf.titlebar.height ? True : False; - conf.titlebar.bg = getcolor(var_to_str(cfg_getstr(cfg_titlebar, "bg"))); + conf.titlebar.bg_normal = getcolor(var_to_str(cfg_getstr(cfg_titlebar, "bg_normal"))); + conf.titlebar.bg_focus = getcolor(var_to_str(cfg_getstr(cfg_titlebar, "bg_focus"))); conf.titlebar.fg_focus = var_to_str(cfg_getstr(cfg_titlebar, "fg_focus")); conf.titlebar.fg_normal = var_to_str(cfg_getstr(cfg_titlebar, "fg_normal")); diff --git a/src/layout.c b/src/layout.c index ff4be1c..f873120 100644 --- a/src/layout.c +++ b/src/layout.c @@ -227,7 +227,7 @@ grid(void) cgeo.width = sgeo.width - cgeo.x - border; /* Resize */ - client_moveresize(c, cgeo, False); + client_moveresize(c, cgeo, tags[seltag].resizehint); /* Set all the other size with current client info */ cgeo.y = c->geo.y + c->geo.height + border + conf.titlebar.height; diff --git a/src/structs.h b/src/structs.h index 5b2acf4..9c4f60b 100644 --- a/src/structs.h +++ b/src/structs.h @@ -182,7 +182,8 @@ typedef struct Bool exist; Position pos; int height; - uint bg; + uint bg_normal; + uint bg_focus; char *fg_focus; char *fg_normal; Position text_align; diff --git a/src/titlebar.c b/src/titlebar.c index 61ee74b..b4069a5 100644 --- a/src/titlebar.c +++ b/src/titlebar.c @@ -52,8 +52,8 @@ titlebar_create(Client *c) c->tbar = bar_create(c->geo.x, y, c->geo.width, conf.titlebar.height - conf.client.borderheight, conf.client.borderheight, - conf.titlebar.bg, True); - XSetWindowBorder(dpy, c->tbar->win, conf.titlebar.bg); + conf.titlebar.bg_normal, True); + XSetWindowBorder(dpy, c->tbar->win, conf.titlebar.bg_normal); return; } @@ -108,6 +108,8 @@ void titlebar_update(Client *c) { int pos_y, pos_x; + uint bg; + char *fg; XFetchName(dpy, c->win, &(c->title)); if(!c->title) @@ -116,10 +118,20 @@ titlebar_update(Client *c) if(!conf.titlebar.exist) return; + /* Set titlebar color */ + bg = (c == sel) + ? conf.titlebar.bg_focus + : conf.titlebar.bg_normal; + fg = (c == sel) + ? conf.titlebar.fg_focus + : conf.titlebar.fg_normal; + c->tbar->color = bg; + + /* Refresh titlebar color */ bar_refresh_color(c->tbar); /* Draw the client title in the titlebar *logeek* */ - if(conf.titlebar.height > 9) + if(conf.titlebar.height > fonth) { /* Set the text alignement */ switch(conf.titlebar.text_align) @@ -140,11 +152,9 @@ titlebar_update(Client *c) pos_y = (fonth - (xftfont->descent )) + ((conf.titlebar.height - fonth) / 2); /* Draw title */ - //if(c->title) - draw_text(c->tbar->dr, pos_x, pos_y, - (c == sel) ? conf.titlebar.fg_focus : conf.titlebar.fg_normal, - conf.titlebar.bg, 0, c->title); + draw_text(c->tbar->dr, pos_x, pos_y, fg, bg, 0, c->title); } + bar_refresh(c->tbar); return; diff --git a/src/wmfs.c b/src/wmfs.c index ad2504e..6533a05 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -132,7 +132,6 @@ init(void) fonth = (xftfont->ascent + xftfont->descent); barheight = fonth + (float)4.5; - /* INIT CURSOR */ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); @@ -184,6 +183,10 @@ init(void) /* INIT STUFF */ grabkeys(); + /* MISC WARNING */ + if(conf.titlebar.height - 1 < fonth) + fprintf(stderr, "WMFS Warning: Font too big, can't draw any text in the titlebar.\n"); + return; } diff --git a/wmfsrc b/wmfsrc index 186a289..c2452bb 100644 --- a/wmfsrc +++ b/wmfsrc @@ -77,8 +77,9 @@ client titlebar { position = "top" - height = 12 - bg = "#191919" + height = 13 + bg_normal = "#191919" + bg_focus = "#191919" fg_normal = "#D4D4D4" fg_focus = "#D4D4D4" text_align = "center"