dwm-rainbowtags-6.2-alpha.diff (2047B)
1 diff --git a/config.def.h b/config.def.h 2 index 1c0b587..80d0e6e 100644 3 --- a/config.def.h 4 +++ b/config.def.h 5 @@ -21,6 +21,20 @@ 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 unsigned int tagalpha[] = { OPAQUE, baralpha }; 22 + 23 static const Rule rules[] = { 24 /* xprop(1): 25 * WM_CLASS(STRING) = instance, class 26 diff --git a/dwm.c b/dwm.c 27 index b0b3466..23d1c46 100644 28 --- a/dwm.c 29 +++ b/dwm.c 30 @@ -264,6 +264,7 @@ static Atom wmatom[WMLast], netatom[NetLast]; 31 static int running = 1; 32 static Cur *cursor[CurLast]; 33 static Clr **scheme; 34 +static Clr **tagscheme; 35 static Display *dpy; 36 static Drw *drw; 37 static Monitor *mons, *selmon; 38 @@ -717,7 +718,7 @@ drawbar(Monitor *m) 39 x = 0; 40 for (i = 0; i < LENGTH(tags); i++) { 41 w = TEXTW(tags[i]); 42 - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); 43 + drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeNorm])); 44 drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); 45 if (occ & 1 << i) 46 drw_rect(drw, x + boxs, boxs, boxw, boxw, 47 @@ -1568,9 +1569,14 @@ setup(void) 48 cursor[CurResize] = drw_cur_create(drw, XC_sizing); 49 cursor[CurMove] = drw_cur_create(drw, XC_fleur); 50 /* init appearance */ 51 + if (LENGTH(tags) > LENGTH(tagsel)) 52 + die("too few color schemes for the tags"); 53 scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); 54 for (i = 0; i < LENGTH(colors); i++) 55 scheme[i] = drw_scm_create(drw, colors[i], 3); 56 + tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *)); 57 + for (i = 0; i < LENGTH(tagsel); i++) 58 + tagscheme[i] = drw_scm_create(drw, tagsel[i], tagalpha, 2); 59 /* init bars */ 60 updatebars(); 61 updatestatus();