dwm

my heavily-patched and customized dwm build
git clone git://git.kocotian.pl/dwm.git
Log | Files | Refs | README | LICENSE

commit 653721f1a8efbc5a69d5f2f1d93c9d7fca876f46
parent cea7e0cb32d5662d0b1d7d794430a367cc33b0a5
Author: kocotian <kocotian@kocotian.pl>
Date:   Sat, 13 Feb 2021 15:42:25 +0100

center window name in config

Diffstat:
Mconfig.def.h | 1+
Mdwm.c | 11+++++++----
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -15,6 +15,7 @@ static const int topbar = 1; /* 0 means bottom bar */ static const char statussep = ';'; /* separator between status bars */ static const int barheight = 25; /* height of a bar; 0 equals autocalculation */ static const int attachdirection = 0; /* 0 default, 1 above, 2 aside, 3 below, 4 bottom, 5 top */ +static const int centerwindowname = 0; /* 0 means window name on the left */ static const char *fonts[] = { "monospace:size=8", "JoyPixels:pixelsize=10:antialias=true:autohint=true" }; static const char dmenufont[] = "monospace:size=8"; diff --git a/dwm.c b/dwm.c @@ -1116,11 +1116,14 @@ 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; + int mid; + if (centerwindowname) { + 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 ? SchemeInfoSel : SchemeInfoNorm]); - drw_text(drw, x, 2, w, dbh, mid, m->sel->name, 0); + drw_text(drw, x, 2, w, dbh, centerwindowname ? mid : (lrpad / 2), m->sel->name, 0); drw_setscheme(drw, scheme[m->sel->isfloating ? SchemeTagLnSel : SchemeTagLnNorm]); drw_rect(drw, x + 1, 0, w - 2, 2, 1, 1); } else {