dwm-rainbowtags-6.2.diff (1973B)
1 diff --git a/config.def.h b/config.def.h 2 index 1c0b587..3fb5cf8 100644 3 --- a/config.def.h 4 +++ b/config.def.h 5 @@ -21,6 +21,18 @@ static const char *colors[][3] = { 6 /* tagging */ 7 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 8 9 +static const char *tagsel[][2] = { 10 + { "#ffffff", "#ff0000" }, 11 + { "#ffffff", "#ff7f00" }, 12 + { "#000000", "#ffff00" }, 13 + { "#000000", "#00ff00" }, 14 + { "#ffffff", "#0000ff" }, 15 + { "#ffffff", "#4b0082" }, 16 + { "#ffffff", "#9400d3" }, 17 + { "#000000", "#ffffff" }, 18 + { "#ffffff", "#000000" }, 19 +}; 20 + 21 static const Rule rules[] = { 22 /* xprop(1): 23 * WM_CLASS(STRING) = instance, class 24 diff --git a/dwm.c b/dwm.c 25 index b0b3466..c16d5f5 100644 26 --- a/dwm.c 27 +++ b/dwm.c 28 @@ -264,6 +264,7 @@ static Atom wmatom[WMLast], netatom[NetLast]; 29 static int running = 1; 30 static Cur *cursor[CurLast]; 31 static Clr **scheme; 32 +static Clr **tagscheme; 33 static Display *dpy; 34 static Drw *drw; 35 static Monitor *mons, *selmon; 36 @@ -717,7 +718,7 @@ drawbar(Monitor *m) 37 x = 0; 38 for (i = 0; i < LENGTH(tags); i++) { 39 w = TEXTW(tags[i]); 40 - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 41 + drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeNorm])); 42 drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 43 if (occ & 1 << i) 44 drw_rect(drw, x + boxs, boxs, boxw, boxw, 45 @@ -1568,9 +1569,14 @@ setup(void) 46 cursor[CurResize] = drw_cur_create(drw, XC_sizing); 47 cursor[CurMove] = drw_cur_create(drw, XC_fleur); 48 /* init appearance */ 49 + if (LENGTH(tags) > LENGTH(tagsel)) 50 + die("too few color schemes for the tags"); 51 scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); 52 for (i = 0; i < LENGTH(colors); i++) 53 scheme[i] = drw_scm_create(drw, colors[i], 3); 54 + tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *)); 55 + for (i = 0; i < LENGTH(tagsel); i++) 56 + tagscheme[i] = drw_scm_create(drw, tagsel[i], 2); 57 /* init bars */ 58 updatebars(); 59 updatestatus();