diff options
-rw-r--r-- | applied/dwm-rainbowtags-6.2.diff | 59 | ||||
-rw-r--r-- | config.def.h | 13 | ||||
-rw-r--r-- | dwm.c | 27 |
3 files changed, 95 insertions, 4 deletions
diff --git a/applied/dwm-rainbowtags-6.2.diff b/applied/dwm-rainbowtags-6.2.diff new file mode 100644 index 0000000..6c31062 --- /dev/null +++ b/applied/dwm-rainbowtags-6.2.diff @@ -0,0 +1,59 @@ +diff --git a/config.def.h b/config.def.h +index 1c0b587..3fb5cf8 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -21,6 +21,18 @@ static const char *colors[][3] = { + /* tagging */ + static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + ++static const char *tagsel[][2] = { ++ { "#ffffff", "#ff0000" }, ++ { "#ffffff", "#ff7f00" }, ++ { "#000000", "#ffff00" }, ++ { "#000000", "#00ff00" }, ++ { "#ffffff", "#0000ff" }, ++ { "#ffffff", "#4b0082" }, ++ { "#ffffff", "#9400d3" }, ++ { "#000000", "#ffffff" }, ++ { "#ffffff", "#000000" }, ++}; ++ + static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class +diff --git a/dwm.c b/dwm.c +index b0b3466..c16d5f5 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; +@@ -717,7 +718,7 @@ drawbar(Monitor *m) + 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_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[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, +@@ -1568,9 +1569,14 @@ setup(void) + cursor[CurResize] = drw_cur_create(drw, XC_sizing); + cursor[CurMove] = drw_cur_create(drw, XC_fleur); + /* init appearance */ ++ if (LENGTH(tags) > LENGTH(tagsel)) ++ die("too few color schemes for the tags"); + 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(); diff --git a/config.def.h b/config.def.h index 33d524c..c8b3b43 100644 --- a/config.def.h +++ b/config.def.h @@ -52,6 +52,19 @@ static Sp scratchpads[] = { /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +static const char *tagsel[][2] = { + /* fg bg */ + { "#ebdbb2", "#cc241d" }, + { "#ebdbb2", "#98971a" }, + { "#ebdbb2", "#d79921" }, + { "#ebdbb2", "#458588" }, + { "#ebdbb2", "#b16286" }, + { "#ebdbb2", "#fb4934" }, + { "#ebdbb2", "#b8bb26" }, + { "#ebdbb2", "#fabd2f" }, + { "#ebdbb2", "#83a598" }, +}; + /* grid of tags */ #define DRAWCLASSICTAGS 1 << 0 #define DRAWTAGGRID 1 << 1 @@ -339,6 +339,7 @@ static int restart = 0; static int running = 1; static Cur *cursor[CurLast]; static Clr **scheme; +static Clr **tagscheme; static Display *dpy; static Drw *drw; static Monitor *mons, *selmon; @@ -851,6 +852,9 @@ cleanup(void) for (i = 0; i < LENGTH(colors) + 1; i++) free(scheme[i]); free(scheme); + for (i = 0; i < LENGTH(tags); i++) + free(tagscheme[i]); + free(tagscheme); XDestroyWindow(dpy, wmcheckwin); drw_free(drw); XSync(dpy, False); @@ -1159,7 +1163,7 @@ drawbar(Monitor *m) if (drawtagmask & DRAWCLASSICTAGS) for (i = 0; i < LENGTH(tags); i++) { w = TEXTW(tags[i]); - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); + drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[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, @@ -1322,13 +1326,13 @@ drawtaggrid(Monitor *m, int *x_pos, unsigned int occ) invert = m->tagset[m->seltags] & 1 << i ? 0 : 1; /* Select active color for current square */ - XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeSel][ColBg].pixel : + XSetForeground(drw->dpy, drw->gc, !invert ? tagscheme[i][1].pixel : scheme[SchemeNorm][ColFg].pixel); XFillRectangle(dpy, drw->drawable, drw->gc, x+1, y+1, h-1, h-1); /* Mark square if tag has client */ if (occ & 1 << i) { - XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeSel][ColFg].pixel : + XSetForeground(drw->dpy, drw->gc, !invert ? tagscheme[i][0].pixel : scheme[SchemeNorm][ColBg].pixel); XFillRectangle(dpy, drw->drawable, drw->gc, x + 1, y + 1, h / 2, h / 2); @@ -1369,6 +1373,9 @@ findbefore(Client *c) void focus(Client *c) { + unsigned int focused_tag; + int i; + if (!c || !ISVISIBLE(c)) for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); if (selmon->sel && selmon->sel != c) @@ -1381,7 +1388,14 @@ focus(Client *c) detachstack(c); attachstack(c); grabbuttons(c, 1); - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + focused_tag = selmon->tagset[selmon->seltags]; + for (i = 0; i < LENGTH(tags); i++) { + if (focused_tag & (1 << (i - 1))) { + break; + } + } + // XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + XSetWindowBorder(dpy, c->win, tagscheme[i - 1][1].pixel); setfocus(c); } else { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); @@ -2407,10 +2421,15 @@ setup(void) cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurMove] = drw_cur_create(drw, XC_fleur); /* init appearance */ + if (LENGTH(tags) > LENGTH(tagsel)) + die("too few color schemes for the tags"); scheme = ecalloc(LENGTH(colors) + 1, sizeof(Clr *)); scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], 3); 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 system tray */ updatesystray(); /* init bars */ |