From 1e116e234f0bc2f9086f94338ec178258d5a0f69 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Mon, 6 Oct 2008 07:03:43 +0200 Subject: [PATCH] [ALL] Add some color in the conf --- config.c | 42 ++++++++++++++++++++++++++---------------- wmfs.c | 26 +++++++++++++++----------- wmfs.h | 5 +++++ wmfsrc | 34 ++++++++++++++++++++++++++-------- 4 files changed, 72 insertions(+), 35 deletions(-) diff --git a/config.c b/config.c index 00be1a0..45993f1 100644 --- a/config.c +++ b/config.c @@ -154,14 +154,19 @@ init_conf(void) static cfg_opt_t colors_opts[] = { - CFG_STR("border_normal", "#354B5C", CFGF_NONE), - CFG_STR("border_focus", "#6286A1", CFGF_NONE), - CFG_STR("bar", "#090909", CFGF_NONE), - CFG_STR("text", "#6289A1", CFGF_NONE), - CFG_STR("tag_sel_fg", "#FFFFFF", CFGF_NONE), - CFG_STR("tag_sel_bg", "#354B5C", CFGF_NONE), - CFG_STR("layout_fg", "#FFFFFF", CFGF_NONE), - CFG_STR("layout_bg", "#292929", CFGF_NONE), + CFG_STR("background", "#090909", CFGF_NONE), + CFG_STR("border_normal", "#354B5C", CFGF_NONE), + CFG_STR("border_focus", "#6286A1", CFGF_NONE), + CFG_STR("bar_bg", "#090909", CFGF_NONE), + CFG_STR("bar_fg", "#6289A1", CFGF_NONE), + CFG_STR("tag_sel_fg", "#FFFFFF", CFGF_NONE), + CFG_STR("tag_sel_bg", "#354B5C", CFGF_NONE), + CFG_STR("layout_fg", "#FFFFFF", CFGF_NONE), + CFG_STR("layout_bg", "#292929", CFGF_NONE), + CFG_STR("titlebar_text_focus", "#FFFFFF", CFGF_NONE), + CFG_STR("titlebar_text_normal", "#FFFFFF", CFGF_NONE), + CFG_STR("button", "#6286A1", CFGF_NONE), + CFG_STR("button_border", "#354B5C", CFGF_NONE), CFG_END() }; @@ -294,14 +299,19 @@ init_conf(void) conf.font.size = cfg_getint(cfg_font, "size"); /* colors */ - conf.colors.bordernormal = getcolor(strdup(cfg_getstr(cfg_colors, "border_normal"))); - conf.colors.borderfocus = getcolor(strdup(cfg_getstr(cfg_colors, "border_focus"))); - conf.colors.bar = getcolor(strdup(cfg_getstr(cfg_colors, "bar"))); - conf.colors.text = getcolor(strdup(cfg_getstr(cfg_colors, "text"))); - conf.colors.tagselfg = getcolor(strdup(cfg_getstr(cfg_colors, "tag_sel_fg"))); - conf.colors.tagselbg = getcolor(strdup(cfg_getstr(cfg_colors, "tag_sel_bg"))); - conf.colors.layout_fg = getcolor(strdup(cfg_getstr(cfg_colors, "layout_fg"))); - conf.colors.layout_bg = getcolor(strdup(cfg_getstr(cfg_colors, "layout_bg"))); + conf.colors.background = getcolor(strdup(cfg_getstr(cfg_colors, "background"))); + conf.colors.bordernormal = getcolor(strdup(cfg_getstr(cfg_colors, "border_normal"))); + conf.colors.borderfocus = getcolor(strdup(cfg_getstr(cfg_colors, "border_focus"))); + conf.colors.bar = getcolor(strdup(cfg_getstr(cfg_colors, "bar_bg"))); + conf.colors.text = getcolor(strdup(cfg_getstr(cfg_colors, "bar_fg"))); + conf.colors.tagselfg = getcolor(strdup(cfg_getstr(cfg_colors, "tag_sel_fg"))); + conf.colors.tagselbg = getcolor(strdup(cfg_getstr(cfg_colors, "tag_sel_bg"))); + conf.colors.layout_fg = getcolor(strdup(cfg_getstr(cfg_colors, "layout_fg"))); + conf.colors.layout_bg = getcolor(strdup(cfg_getstr(cfg_colors, "layout_bg"))); + conf.colors.ttbar_text_focus = getcolor(strdup(cfg_getstr(cfg_colors, "titlebar_text_focus"))); + conf.colors.ttbar_text_normal = getcolor(strdup(cfg_getstr(cfg_colors, "titlebar_text_normal"))); + conf.colors.button = getcolor(strdup(cfg_getstr(cfg_colors, "button"))); + conf.colors.button_border = getcolor(strdup(cfg_getstr(cfg_colors, "button_border"))); /* layout */ if((conf.nlayout = cfg_size(cfg_layouts, "layout")) > MAXLAYOUT diff --git a/wmfs.c b/wmfs.c index 02db7d1..a00aae7 100644 --- a/wmfs.c +++ b/wmfs.c @@ -174,6 +174,7 @@ focus(Client *c) setborder(sel->win, conf.colors.bordernormal); if(conf.ttbarheight) setborder(sel->tbar, conf.colors.bordernormal); + } if(c) grabbuttons(c, True); @@ -194,7 +195,8 @@ focus(Client *c) else XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); - return; + updateall(); + return; } Client* @@ -396,6 +398,7 @@ init(void) EnterWindowMask | LeaveWindowMask | StructureNotifyMask ; at.cursor = cursor[CurNormal]; XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &at); + XSetWindowBackground(dpy, root, conf.colors.background); /* INIT BAR / BUTTON */ bary = (conf.bartop) ? 0 : mh - barheight; @@ -407,7 +410,7 @@ init(void) CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &at); XMapRaised(dpy, bar); - strcpy(bartext, WMFS_VERSION); + strcpy(bartext, "WMFS-" WMFS_VERSION); updatebutton(False); updatebar(); @@ -549,8 +552,8 @@ manage(Window w, XWindowAttributes *wa) BUTY(c->y), ((BUTH) ? BUTH : 1), ((BUTH) ? BUTH : 1), - 1, conf.colors.bordernormal, - conf.colors.borderfocus); + 1, conf.colors.button_border, + conf.colors.button); } XConfigureWindow(dpy, w, CWBorderWidth, &winc); @@ -936,7 +939,7 @@ updateall(void) void updatebar(void) { - int i , k; + int i , k, sp = 4; char buf[conf.ntag][256]; char p[4]; @@ -946,19 +949,19 @@ updatebar(void) { /* Make the tags string */ ITOA(p, clientpertag(i+1)); - sprintf(buf[i], "%s<%s> ", tags[i+1].name, (clientpertag(i+1)) ? p : ""); - taglen[i+1] = taglen[i] + TEXTW(buf[i]); + sprintf(buf[i], "%s<%s>", tags[i+1].name, (clientpertag(i+1)) ? p : ""); + taglen[i+1] = taglen[i] + TEXTW(buf[i]) + sp; /* Draw tags */ xprint(dr, taglen[i], fonth, ((i+1 == seltag) ? conf.colors.tagselfg : conf.colors.text), - ((i+1 == seltag) ? conf.colors.tagselbg : conf.colors.bar), 3, 3, buf[i]); + ((i+1 == seltag) ? conf.colors.tagselbg : conf.colors.bar), 3, -3, buf[i]); } /* Layout symbol */ - xprint(dr, taglen[conf.ntag] - 4, + xprint(dr, taglen[conf.ntag] - sp/2, fonth, conf.colors.layout_fg, conf.colors.layout_bg, - 1, -1, tags[seltag].layout.symbol); + 1, 0, tags[seltag].layout.symbol); /* Draw status text */ k = TEXTW(bartext); @@ -1058,7 +1061,8 @@ updatetitle(Client *c) { XClearWindow(dpy, c->tbar); xprint(c->tbar, 3, ((fonth-2) + ((conf.ttbarheight - fonth) / 2)), - conf.colors.text, conf.colors.bar, 0, 0, c->title); + ((c == sel) ? conf.colors.ttbar_text_focus : conf.colors.ttbar_text_normal), + conf.colors.bar, 0, 0, c->title); } return; } diff --git a/wmfs.h b/wmfs.h index 6cbf631..1eb0fac 100644 --- a/wmfs.h +++ b/wmfs.h @@ -146,6 +146,7 @@ typedef struct } font; struct { + uint background; uint bordernormal; uint borderfocus; uint bar; @@ -154,6 +155,10 @@ typedef struct uint tagselbg; uint layout_fg; uint layout_bg; + uint ttbar_text_focus; + uint ttbar_text_normal; + uint button; + uint button_border; } colors; Tag tag[MAXTAG]; Layout layout[MAXLAYOUT]; diff --git a/wmfsrc b/wmfsrc index bce2996..c251bfe 100644 --- a/wmfsrc +++ b/wmfsrc @@ -18,14 +18,32 @@ font colors { - border_normal = "#3F485E" - border_focus = "#7E89A2" - bar = "#191919" - text = "#D4D4D4" - tag_sel_fg = "#000000" - tag_sel_bg = "#7E89A2" - layout_fg = "#000000" - layout_bg = "#7E89A2" + #Desktop + background = "#090909" + + #Border + border_normal = "#3F485E" + border_focus = "#7E89A2" + + #Bar + bar_bg = "#191919" + bar_fg = "#D4D4D4" + + #Tag + tag_sel_fg = "#191919" + tag_sel_bg = "#7E89A2" + + #Layout + layout_fg = "#191919" + layout_bg = "#7E89A2" + + #Titlebar + titlebar_text_focus = "#D4D4D4" + titlebar_text_normal = "#D4D4D4" + + #Button + button = "#7E89A2" + button_border = "#3F485E" } layouts