commit 758b9b51ae0b933059499a698c3bb53943dca12b
parent dc8cf2cccade6def356b434fa04d0eca29d162b6
Author: ssnf <ssnf@ssnf.xyz>
Date: Tue, 20 Sep 2022 12:42:02 +0000
centered title
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c
@@ -807,7 +807,10 @@ drawbar(Monitor* m)
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0);
+ if (TEXTW(m->sel->name) > w)
+ drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0);
+ else
+ drw_text(drw, x, 0, w - 2 * sp, bh, (w - TEXTW(m->sel->name)) / 2, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {