dwm-noxz

[fork] suckless dwm - personal fork
git clone git://git.noxz.tech/dwm-noxz
Log | Files | Refs | README | LICENSE

commit 4ed082221dd86584c0049a5fd57139d07e627a59
parent 9bde2dc5a32ebac52f0281c5814575c3961e3131
Author: Chris Noxz <chris@noxz.tech>
Date:   Wed,  5 Feb 2020 12:18:11 +0100

Fix status length by excluding color scheme references

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

diff --git a/dwm.c b/dwm.c @@ -859,7 +859,19 @@ drawbar(Monitor *m) /* draw status first so it can be overdrawn by tags later */ if (m == selmon) { /* status is only drawn on selected monitor */ drw_setscheme(drw, scheme[SchemeStatusNorm]); - sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ + /* get string width excluding color scheme references */ + while (1) { + if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; } + ctmp = *ts; + *ts = '\0'; + sw += TEXTW(tp) -lrpad; + if (ctmp == '\0') { break; } + *ts = ctmp; + tp = ++ts; + } + sw += 2; /* 2px right padding */ + ts = stext; + tp = stext; while (1) { if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; } ctmp = *ts;