sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-rearrangebar-20210415-67d76bd.diff (1779B)


      1 From 891abc2738b6158637acbb6d336162e23dd58f5f Mon Sep 17 00:00:00 2001
      2 From: DogeyStamp <adeng.sean@gmail.com>
      3 Date: Thu, 15 Apr 2021 20:11:29 -0400
      4 Subject: [PATCH] Rearrange bar
      5 
      6 Modify bar so tiling method is at the right and window name is in the
      7 center.
      8 ---
      9  dwm.c | 14 +++++++++-----
     10  1 file changed, 9 insertions(+), 5 deletions(-)
     11 
     12 diff --git a/dwm.c b/dwm.c
     13 index b0b3466..5fff112 100644
     14 --- a/dwm.c
     15 +++ b/dwm.c
     16 @@ -701,12 +701,17 @@ drawbar(Monitor *m)
     17  	int boxw = drw->fonts->h / 6 + 2;
     18  	unsigned int i, occ = 0, urg = 0;
     19  	Client *c;
     20 +	w = blw = TEXTW(m->ltsymbol);
     21 +
     22 +	/* clear bar from last draw */
     23 +	drw_setscheme(drw, scheme[SchemeNorm]);
     24 +	drw_rect(drw, 0, 0, m->ww, bh, lrpad / 2, 1);
     25  
     26  	/* draw status first so it can be overdrawn by tags later */
     27  	if (m == selmon) { /* status is only drawn on selected monitor */
     28 -		drw_setscheme(drw, scheme[SchemeNorm]);
     29 -		tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
     30 +		tw = TEXTW(stext) - lrpad + w; /* right padding for the tiling symbol */
     31  		drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
     32 +		drw_text(drw, m->ww - w, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
     33  	}
     34  
     35  	for (c = m->clients; c; c = c->next) {
     36 @@ -725,14 +730,13 @@ drawbar(Monitor *m)
     37  				urg & 1 << i);
     38  		x += w;
     39  	}
     40 -	w = blw = TEXTW(m->ltsymbol);
     41  	drw_setscheme(drw, scheme[SchemeNorm]);
     42 -	x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
     43 +	x = m->ww/3;
     44  
     45  	if ((w = m->ww - tw - x) > bh) {
     46  		if (m->sel) {
     47  			drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
     48 -			drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
     49 +			drw_text(drw, x, 0, m->ww/3, bh, lrpad / 2, m->sel->name, 0);
     50  			if (m->sel->isfloating)
     51  				drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
     52  		} else {
     53 -- 
     54 2.31.1
     55