aboutsummaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index 3a950be..f33edd9 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1084,6 +1084,7 @@ void
drawbar(Monitor *m)
{
int x, w, tw = 0, stw = 0;
+ int tlpad;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@@ -1127,6 +1128,12 @@ drawbar(Monitor *m)
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2 + (m->sel->icon ? m->sel->icw + ICONSPACING : 0), m->sel->name, 0);
+ if (centretitle) {
+ tlpad = MAX((m->ww - ((int)TEXTW(m->sel->name) - lrpad)) / 2 - x, lrpad / 2 + (m->sel->icon ? m->sel->icw + ICONSPACING : 0));
+ drw_text(drw, x, 0, w - 2 * sp, bh, tlpad, m->sel->name, 0);
+ } else {
+ drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2 + (m->sel->icon ? m->sel->icw + ICONSPACING : 0), m->sel->name, 0);
+ }
if (m->sel->icon) drw_pic(drw, x + lrpad / 2, (bh - m->sel->ich) / 2, m->sel->icw, m->sel->ich, m->sel->icon);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);