From aac9b78319a13acd8e3cfbc66f4556f20abf8a3d Mon Sep 17 00:00:00 2001 From: David Delassus Date: Mon, 1 Dec 2008 22:26:34 +0100 Subject: [PATCH] infobar: Add color on the occupied tag by clients Signed-off-by: David Delassus --- src/config.c | 9 ++++++--- src/infobar.c | 12 ++++++++++++ src/structs.h | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 12180a7..e3255fa 100644 --- a/src/config.c +++ b/src/config.c @@ -126,6 +126,7 @@ static cfg_opt_t tag_opts[] = static cfg_opt_t tags_opts[] = { + CFG_STR("occupied_bg", "#003366", CFGF_NONE), CFG_STR("sel_fg", "#FFFFFF", CFGF_NONE), CFG_STR("sel_bg", "#354B5C", CFGF_NONE), CFG_STR("border", "#090909", CFGF_NONE), @@ -454,9 +455,10 @@ init_conf(void) * If there is no tag in the conf or more than * MAXTAG (32) print an error and create only one. */ - conf.colors.tagselfg = strdup(var_to_str(cfg_getstr(cfg_tags, "sel_fg"))); - conf.colors.tagselbg = getcolor(var_to_str(cfg_getstr(cfg_tags, "sel_bg"))); - conf.colors.tagbord = getcolor(var_to_str(cfg_getstr(cfg_tags, "border"))); + conf.colors.tagselfg = strdup(var_to_str(cfg_getstr(cfg_tags, "sel_fg"))); + conf.colors.tagselbg = getcolor(var_to_str(cfg_getstr(cfg_tags, "sel_bg"))); + conf.colors.tag_occupied_bg = getcolor(var_to_str(cfg_getstr(cfg_tags, "occupied_bg"))); + conf.colors.tagbord = getcolor(var_to_str(cfg_getstr(cfg_tags, "border"))); /* Alloc all */ conf.ntag = emalloc(screen_count(), sizeof(int)); @@ -478,6 +480,7 @@ init_conf(void) tags[j][conf.ntag[j]].resizehint = cfg_getbool(cfgtmp, "resizehint"); tags[j][conf.ntag[j]].layout = layout_name_to_struct(conf.layout, cfg_getstr(cfgtmp, "layout"), conf.nlayout); } + for(i = 0; i < screen_count(); ++i) if(!conf.ntag[i] || conf.ntag[i] > MAXTAG) { diff --git a/src/infobar.c b/src/infobar.c index 332b082..a88d2fd 100644 --- a/src/infobar.c +++ b/src/infobar.c @@ -127,8 +127,20 @@ infobar_draw_taglist(int sc) for(i = 1; i < conf.ntag[sc] + 1; ++i) { + Client *c; + infobar[sc].tags[i]->color = ((i == seltag[sc]) ? conf.colors.tagselbg : conf.colors.bar); barwin_refresh_color(infobar[sc].tags[i]); + + for(c = clients; c; c = c->next) + { + if(c->screen == sc) + { + infobar[sc].tags[c->tag]->color = ((c->tag == seltag[sc]) ? conf.colors.tagselbg : conf.colors.tag_occupied_bg); + barwin_refresh_color(infobar[sc].tags[i]); + } + } + if(tags[sc][i].name) draw_text(infobar[sc].tags[i]->dr, PAD / 2, diff --git a/src/structs.h b/src/structs.h index b5934e7..a5bab53 100644 --- a/src/structs.h +++ b/src/structs.h @@ -173,6 +173,7 @@ typedef struct char *text; char *tagselfg; uint tagselbg; + uint tag_occupied_bg; uint tagbord; char *layout_fg; uint layout_bg;