dwm-tagcolorscheme-6.4.diff (2896B)
1 diff --git a/config.def.h b/config.def.h 2 index 061ad66..6fd24f0 100644 3 --- a/config.def.h 4 +++ b/config.def.h 5 @@ -18,6 +18,13 @@ static const char *colors[][3] = { 6 [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 7 }; 8 9 +static const char *tagsel[][2] = { 10 + /* fg bg */ 11 + { col_gray3, col_gray1 }, /* norm */ 12 + { col_gray4, col_cyan }, /* sel */ 13 + { col_cyan, col_gray1 }, /* occ but not sel */ 14 + { col_cyan, col_gray3 }, /* has pinned tag */ 15 +}; 16 /* tagging */ 17 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 18 19 diff --git a/dwm.c b/dwm.c 20 index e5efb6a..bc7c2a8 100644 21 --- a/dwm.c 22 +++ b/dwm.c 23 @@ -264,6 +264,7 @@ static Atom wmatom[WMLast], netatom[NetLast]; 24 static int running = 1; 25 static Cur *cursor[CurLast]; 26 static Clr **scheme; 27 +static Clr **tagscheme; 28 static Display *dpy; 29 static Drw *drw; 30 static Monitor *mons, *selmon; 31 @@ -487,9 +488,12 @@ cleanup(void) 32 cleanupmon(mons); 33 for (i = 0; i < CurLast; i++) 34 drw_cur_free(drw, cursor[i]); 35 - for (i = 0; i < LENGTH(colors); i++) 36 - free(scheme[i]); 37 + for (i = 0; i < LENGTH(colors); i++) 38 + free(scheme[i]); 39 + for (i = 0; i < LENGTH(tagsel); i++) 40 + free(tagscheme[i]); 41 free(scheme); 42 + free(tagscheme); 43 XDestroyWindow(dpy, wmcheckwin); 44 drw_free(drw); 45 XSync(dpy, False); 46 @@ -721,16 +725,19 @@ drawbar(Monitor *m) 47 urg |= c->tags; 48 } 49 x = 0; 50 - for (i = 0; i < LENGTH(tags); i++) { 51 - w = TEXTW(tags[i]); 52 - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 53 - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 54 - if (occ & 1 << i) 55 - drw_rect(drw, x + boxs, boxs, boxw, boxw, 56 - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 57 - urg & 1 << i); 58 - x += w; 59 - } 60 + for (i = 0; i < LENGTH(tags); i++) { 61 + w = TEXTW(tags[i]); 62 + if (m->tagset[m->seltags] & 1 << i) 63 + drw_setscheme(drw, tagscheme[1]); 64 + else if (m == selmon && selmon->sel && selmon->sel->tags & 1 << i) 65 + drw_setscheme(drw, tagscheme[3]); 66 + else if (occ & 1 << i) 67 + drw_setscheme(drw, tagscheme[2]); 68 + else 69 + drw_setscheme(drw, tagscheme[0]); 70 + drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 71 + x += w; 72 + } 73 w = TEXTW(m->ltsymbol); 74 drw_setscheme(drw, scheme[SchemeNorm]); 75 x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); 76 @@ -1526,7 +1533,6 @@ setmfact(const Arg *arg) 77 selmon->mfact = f; 78 arrange(selmon); 79 } 80 - 81 void 82 setup(void) 83 { 84 @@ -1571,6 +1577,9 @@ setup(void) 85 scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); 86 for (i = 0; i < LENGTH(colors); i++) 87 scheme[i] = drw_scm_create(drw, colors[i], 3); 88 + tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *)); 89 + for (i = 0; i < LENGTH(tagsel); i++) 90 + tagscheme[i] = drw_scm_create(drw, tagsel[i], 2); 91 /* init bars */ 92 updatebars(); 93 updatestatus();