aboutsummaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-05-23 16:49:08 -0700
committerFuwn <[email protected]>2024-05-23 16:49:08 -0700
commit7078f320bcaa6c3cef080831fdf70852eea2b4da (patch)
tree6e6a96b0bacbddd30b3ec9aea55ca2f2f9584a91 /dwm.c
parentfeat: add winicon patch (diff)
downloadseiwm-7078f320bcaa6c3cef080831fdf70852eea2b4da.tar.xz
seiwm-7078f320bcaa6c3cef080831fdf70852eea2b4da.zip
feat(dwm.c): add centretitle patch
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);