dwm
dynamic window manager
git clone https://9o.is/git/dwm.git
commit 4caaadf342e067a73f4909038a98aaff19bd0815 parent f7d68a02b873c79ccdbae3ff864e2b7e885aa4df Author: Jul <jul@9o.is> Date: Sun, 1 Feb 2026 16:17:50 -0500 move client counter to the left of tags Diffstat:
| M | dwm.c | | | 18 | +++++++++--------- |
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/dwm.c b/dwm.c @@ -454,8 +454,8 @@ buttonpress(XEvent *e) occ |= c->tags == TAGMASK ? 0 : c->tags; x = TEXTWNP(stext); + x += TEXTW(selmon->ccounter); x += TEXTW(selmon->ltsymbol); - x += TEXTW(selmon->ccounter); // client counter for (i = 0; i < LENGTH(tags); i++) { if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) continue; @@ -465,6 +465,8 @@ buttonpress(XEvent *e) if (ev->x < x) click = ClkWinTitle; + else if (ev->x < (x += TEXTW(selmon->ccounter))) + click = ClkCounter; else { i = 0; do { @@ -477,8 +479,6 @@ buttonpress(XEvent *e) click = ClkTagBar; arg.ui = 1 << i; } - else if (ev->x < (x += TEXTW(selmon->ccounter))) - click = ClkCounter; else if (ev->x < x + TEXTW(selmon->ltsymbol)) click = ClkLtSymbol; else @@ -766,10 +766,10 @@ drawbar(Monitor *m) } } - if (ct == 0) - snprintf(m->ccounter, sizeof(m->ccounter), " "); - else + if (ct > 0) snprintf(m->ccounter, sizeof(m->ccounter), "%d/%d", cn & 0xFF, ct & 0xFF); + else + m->ccounter[0] = '\0'; tw += TEXTW(m->ccounter); tw += TEXTW(m->ltsymbol); @@ -798,6 +798,9 @@ drawbar(Monitor *m) x += w; } + w = TEXTW(m->ccounter); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ccounter, 0); + for (i = 0; i < LENGTH(tags); i++) { if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) continue; @@ -808,9 +811,6 @@ drawbar(Monitor *m) } drw_setscheme(drw, scheme[SchemeNorm]); - w = TEXTW(m->ccounter); - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ccounter, 0); - w = TEXTW(m->ltsymbol); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);