summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorJackson Taylor <jackson@jacksontaylor.xyz>2022-06-20 23:13:32 -0400
committerJackson Taylor <jackson@jacksontaylor.xyz>2022-06-20 23:13:45 -0400
commit44dc681264f8aa626b9ac81a12845997fafd7160 (patch)
tree34ae88d17baafbffca053ec5b6faa59a5254af88 /dwm.c
parentda869fadd0aa4ecd0be5ee0c4576d8160cb9f4b4 (diff)
Add centered window name patchjackson_rebuild
I might remove this, or patch it myself to make it toggled
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/dwm.c b/dwm.c
index ebbf7dd7..444cc358 100644
--- a/dwm.c
+++ b/dwm.c
@@ -741,8 +741,12 @@ drawbar(Monitor *m)
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
+ /* fix overflow when window name is bigger than window width */
+ int mid = (m->ww - (int)TEXTW(m->sel->name)) / 2 - x;
+ /* make sure name will not overlap on tags even when it is very long */
+ mid = mid >= lrpad / 2 ? mid : lrpad / 2;
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
+ drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {