dwm

[fork] dynamic window manager
Log | Files | Refs | README | LICENSE

commit bdf805fcf6aa2aa144f01abaa3df6e2fb06132f2
parent b750c11dae1e93b5e4e295dd1e63a856b00d48ed
Author: hhvn <hayden@haydenvh.com>
Date:   Sat, 26 Dec 2020 19:43:09 +0000

dwm.c: always display number of visible clients next to ltsymbol

Diffstat:
Mdwm.c | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dwm.c b/dwm.c @@ -792,6 +792,7 @@ drawbar(Monitor *m) int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; + char layout[16]; Client *c; /* draw status first so it can be overdrawn by tags later */ @@ -819,9 +820,11 @@ drawbar(Monitor *m) urg & 1 << i); x += w; } - w = blw = TEXTW(m->ltsymbol); + + snprintf(layout, sizeof(layout), "%s%d", m->ltsymbol, n); + w = blw = TEXTW(layout); drw_setscheme(drw, scheme[SchemeNorm]); - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, layout, 0); if ((w = m->ww - sw - x) > bh) { if (n > 0) { @@ -1220,8 +1223,6 @@ monocle(Monitor *m) for (c = m->clients; c; c = c->next) if (ISVISIBLE(c)) n++; - if (n > 0) /* override layout symbol */ - snprintf(m->ltsymbol, sizeof m->ltsymbol, "M%d", n); for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) resize(c, m->wx + m->gappx, m->wy + m->gappx, (m->ww - 2 * c->bw) - 2*m->gappx, (m->wh - 2 * c->bw) - 2*m->gappx, 0); }