dwm

dynamic window manager

git clone https://9o.is/git/dwm.git

commit 7bac5fda8600ce6c3023b54e5429f542b1077205
parent d06b882e7bdab48dc2641e76df792b12341f0450
Author: Jul <jul@9o.is>
Date:   Sun,  1 Feb 2026 13:16:50 -0500

show client counter in status bar

Diffstat:
Mdwm.c | 18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dwm.c b/dwm.c @@ -725,10 +725,11 @@ dirtomon(int dir) void drawbar(Monitor *m) { - int x, w, tw = 0; + int x, w, tw = 0, cn, ct = 0; int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; + char cs[8]; Client *c; if (!m->showbar) @@ -745,8 +746,19 @@ drawbar(Monitor *m) occ |= c->tags == TAGMASK ? 0 : c->tags; if (c->isurgent) urg |= c->tags; + if (c->tags & m->tagset[m->seltags]) { + ct++; + if (c == m->sel) + cn = ct; + } } + if (ct == 0) + snprintf(cs, sizeof(cs), " "); + else + snprintf(cs, sizeof(cs), "%2d/%-2d", cn & 0xFF, ct & 0xFF); + + tw += TEXTW(cs); tw += TEXTW(m->ltsymbol); for (i = 0; i < LENGTH(tags); i++) { if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) @@ -768,6 +780,10 @@ drawbar(Monitor *m) x += w; } + w = TEXTW(cs); + drw_text(drw, x, 0, w, bh, lrpad / 2, cs, 0); + x += w; + for (i = 0; i < LENGTH(tags); i++) { if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) continue;