diff --git a/config.def.h b/config.def.h index 061ad66..6fd24f0 100644 --- a/config.def.h +++ b/config.def.h @@ -18,6 +18,13 @@ static const char *colors[][3] = { [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; +static const char *tagsel[][2] = { + /* fg bg */ + { col_gray3, col_gray1 }, /* norm */ + { col_gray4, col_cyan }, /* sel */ + { col_cyan, col_gray1 }, /* occ but not sel */ + { col_cyan, col_gray3 }, /* has pinned tag */ +}; /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; diff --git a/dwm.c b/dwm.c index e5efb6a..bc7c2a8 100644 --- a/dwm.c +++ b/dwm.c @@ -264,6 +264,7 @@ static Atom wmatom[WMLast], netatom[NetLast]; static int running = 1; static Cur *cursor[CurLast]; static Clr **scheme; +static Clr **tagscheme; static Display *dpy; static Drw *drw; static Monitor *mons, *selmon; @@ -487,9 +488,12 @@ cleanup(void) cleanupmon(mons); for (i = 0; i < CurLast; i++) drw_cur_free(drw, cursor[i]); - for (i = 0; i < LENGTH(colors); i++) - free(scheme[i]); + for (i = 0; i < LENGTH(colors); i++) + free(scheme[i]); + for (i = 0; i < LENGTH(tagsel); i++) + free(tagscheme[i]); free(scheme); + free(tagscheme); XDestroyWindow(dpy, wmcheckwin); drw_free(drw); XSync(dpy, False); @@ -721,16 +725,19 @@ drawbar(Monitor *m) urg |= c->tags; } x = 0; - for (i = 0; i < LENGTH(tags); i++) { - w = TEXTW(tags[i]); - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); - if (occ & 1 << i) - drw_rect(drw, x + boxs, boxs, boxw, boxw, - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, - urg & 1 << i); - x += w; - } + for (i = 0; i < LENGTH(tags); i++) { + w = TEXTW(tags[i]); + if (m->tagset[m->seltags] & 1 << i) + drw_setscheme(drw, tagscheme[1]); + else if (m == selmon && selmon->sel && selmon->sel->tags & 1 << i) + drw_setscheme(drw, tagscheme[3]); + else if (occ & 1 << i) + drw_setscheme(drw, tagscheme[2]); + else + drw_setscheme(drw, tagscheme[0]); + drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); + x += w; + } w = TEXTW(m->ltsymbol); drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); @@ -1526,7 +1533,6 @@ setmfact(const Arg *arg) selmon->mfact = f; arrange(selmon); } - void setup(void) { @@ -1571,6 +1577,9 @@ setup(void) scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); for (i = 0; i < LENGTH(colors); i++) scheme[i] = drw_scm_create(drw, colors[i], 3); + tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *)); + for (i = 0; i < LENGTH(tagsel); i++) + tagscheme[i] = drw_scm_create(drw, tagsel[i], 2); /* init bars */ updatebars(); updatestatus();