diff --git a/config.def.h b/config.def.h index 8cd3204..182e9b8 100644 --- a/config.def.h +++ b/config.def.h @@ -20,6 +20,7 @@ static const char *colors[][3] = { /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +static const char *alttags[] = { "<01>", "<02>", "<03>", "<04>", "<05>" }; static const Rule rules[] = { /* xprop(1): diff --git a/dwm-alttagsdecoration-2020010304-cb3f58a.diff b/dwm-alttagsdecoration-2020010304-cb3f58a.diff new file mode 100644 index 0000000..fcbc1ef --- /dev/null +++ b/dwm-alttagsdecoration-2020010304-cb3f58a.diff @@ -0,0 +1,67 @@ +diff --git a/config.def.h b/config.def.h +index 1c0b587..d4b11fc 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -20,6 +20,7 @@ static const char *colors[][3] = { + + /* tagging */ + static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; ++static const char *alttags[] = { "<01>", "<02>", "<03>", "<04>", "<05>" }; + + static const Rule rules[] = { + /* xprop(1): +diff --git a/dwm.c b/dwm.c +index 4465af1..a394159 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -416,7 +416,7 @@ attachstack(Client *c) + void + buttonpress(XEvent *e) + { +- unsigned int i, x, click; ++ unsigned int i, x, click, occ; + Arg arg = {0}; + Client *c; + Monitor *m; +@@ -430,9 +430,13 @@ buttonpress(XEvent *e) + focus(NULL); + } + if (ev->window == selmon->barwin) { +- i = x = 0; ++ i = x = occ = 0; ++ /* Bitmask of occupied tags */ ++ for (c = m->clients; c; c = c->next) ++ occ |= c->tags; ++ + do +- x += TEXTW(tags[i]); ++ x += TEXTW(occ & 1 << i ? alttags[i] : tags[i]); + while (ev->x >= x && ++i < LENGTH(tags)); + if (i < LENGTH(tags)) { + click = ClkTagBar; +@@ -699,6 +703,7 @@ drawbar(Monitor *m) + int boxs = drw->fonts->h / 9; + int boxw = drw->fonts->h / 6 + 2; + unsigned int i, occ = 0, urg = 0; ++ const char *tagtext; + Client *c; + + /* draw status first so it can be overdrawn by tags later */ +@@ -715,13 +720,10 @@ 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_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); ++ tagtext = occ & 1 << i ? alttags[i] : tags[i]; ++ w = TEXTW(tagtext); ++ drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); ++ drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i); + x += w; + } + w = blw = TEXTW(m->ltsymbol); diff --git a/dwm.c b/dwm.c index c1b899a..0edf02e 100644 --- a/dwm.c +++ b/dwm.c @@ -417,7 +417,7 @@ attachstack(Client *c) void buttonpress(XEvent *e) { - unsigned int i, x, click; + unsigned int i, x, click, occ; Arg arg = {0}; Client *c; Monitor *m; @@ -431,9 +431,13 @@ buttonpress(XEvent *e) focus(NULL); } if (ev->window == selmon->barwin) { - i = x = 0; + i = x = occ = 0; + /* Bitmask of occupied tags */ + for (c = m->clients; c; c = c->next) + occ |= c->tags; + do - x += TEXTW(tags[i]); + x += TEXTW(occ & 1 << i ? alttags[i] : tags[i]); while (ev->x >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { click = ClkTagBar; @@ -700,6 +704,7 @@ drawbar(Monitor *m) int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; + const char *tagtext; Client *c; /* draw status first so it can be overdrawn by tags later */ @@ -716,13 +721,10 @@ 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_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); + tagtext = occ & 1 << i ? alttags[i] : tags[i]; + w = TEXTW(tagtext); + drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i); x += w; } w = blw = TEXTW(m->ltsymbol);