dwm-old

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

dwm-centeredwindowname-20200723-f035e1e.diff (1055B)


      1 From f035e1e5abb19df5dced9c592ca986deac460435 Mon Sep 17 00:00:00 2001
      2 From: bastila <20937049+silentfault@users.noreply.github.com>
      3 Date: Thu, 23 Jul 2020 02:45:12 +0300
      4 Subject: [PATCH] Fix overflow when window name is bigger than window width
      5 
      6 ---
      7  dwm.c | 6 +++++-
      8  1 file changed, 5 insertions(+), 1 deletion(-)
      9 
     10 diff --git a/dwm.c b/dwm.c
     11 index 9fd0286..42cb8dd 100644
     12 --- a/dwm.c
     13 +++ b/dwm.c
     14 @@ -731,8 +731,12 @@ drawbar(Monitor *m)
     15  
     16  	if ((w = m->ww - tw - x) > bh) {
     17  		if (m->sel) {
     18 +            /* fix overflow when window name is bigger than window width */
     19 +			int mid = (m->ww - (int)TEXTW(m->sel->name)) / 2 - x;
     20 +			/* make sure name will not overlap on tags even when it is very long */
     21 +			mid = mid >= lrpad / 2 ? mid : lrpad / 2;
     22  			drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
     23 -			drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
     24 +			drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
     25  			if (m->sel->isfloating)
     26  				drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
     27  		} else {
     28 -- 
     29 2.27.0
     30