My patched version of suckless' dwm.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.0 KiB

  1. diff --git a/config.def.h b/config.def.h
  2. index 1c0b587..d4b11fc 100644
  3. --- a/config.def.h
  4. +++ b/config.def.h
  5. @@ -20,6 +20,7 @@ static const char *colors[][3] = {
  6. /* tagging */
  7. static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
  8. +static const char *alttags[] = { "<01>", "<02>", "<03>", "<04>", "<05>" };
  9. static const Rule rules[] = {
  10. /* xprop(1):
  11. diff --git a/dwm.c b/dwm.c
  12. index 4465af1..a394159 100644
  13. --- a/dwm.c
  14. +++ b/dwm.c
  15. @@ -416,7 +416,7 @@ attachstack(Client *c)
  16. void
  17. buttonpress(XEvent *e)
  18. {
  19. - unsigned int i, x, click;
  20. + unsigned int i, x, click, occ;
  21. Arg arg = {0};
  22. Client *c;
  23. Monitor *m;
  24. @@ -430,9 +430,13 @@ buttonpress(XEvent *e)
  25. focus(NULL);
  26. }
  27. if (ev->window == selmon->barwin) {
  28. - i = x = 0;
  29. + i = x = occ = 0;
  30. + /* Bitmask of occupied tags */
  31. + for (c = m->clients; c; c = c->next)
  32. + occ |= c->tags;
  33. +
  34. do
  35. - x += TEXTW(tags[i]);
  36. + x += TEXTW(occ & 1 << i ? alttags[i] : tags[i]);
  37. while (ev->x >= x && ++i < LENGTH(tags));
  38. if (i < LENGTH(tags)) {
  39. click = ClkTagBar;
  40. @@ -699,6 +703,7 @@ drawbar(Monitor *m)
  41. int boxs = drw->fonts->h / 9;
  42. int boxw = drw->fonts->h / 6 + 2;
  43. unsigned int i, occ = 0, urg = 0;
  44. + const char *tagtext;
  45. Client *c;
  46. /* draw status first so it can be overdrawn by tags later */
  47. @@ -715,13 +720,10 @@ drawbar(Monitor *m)
  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. + tagtext = occ & 1 << i ? alttags[i] : tags[i];
  59. + w = TEXTW(tagtext);
  60. + drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
  61. + drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i);
  62. x += w;
  63. }
  64. w = blw = TEXTW(m->ltsymbol);