sites

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

dwm-leftlayout-20210721-138b405.diff (1830B)


      1 From 9ec1210a82b137014de4644ba65be5e53398e281 Mon Sep 17 00:00:00 2001
      2 From: Jack Bird <jack.bird@durham.ac.uk>
      3 Date: Wed, 21 Jul 2021 16:43:06 +0100
      4 Subject: [PATCH] Updated leftlayout for 138b405
      5 
      6 ---
      7  dwm.c | 31 +++++++++++++++++--------------
      8  1 file changed, 17 insertions(+), 14 deletions(-)
      9 
     10 diff --git a/dwm.c b/dwm.c
     11 index 5e4d494..a5a3980 100644
     12 --- a/dwm.c
     13 +++ b/dwm.c
     14 @@ -432,18 +432,21 @@ buttonpress(XEvent *e)
     15  	}
     16  	if (ev->window == selmon->barwin) {
     17  		i = x = 0;
     18 -		do
     19 -			x += TEXTW(tags[i]);
     20 -		while (ev->x >= x && ++i < LENGTH(tags));
     21 -		if (i < LENGTH(tags)) {
     22 -			click = ClkTagBar;
     23 -			arg.ui = 1 << i;
     24 -		} else if (ev->x < x + blw)
     25 +		x += blw;
     26 +		if (ev->x < x) {
     27  			click = ClkLtSymbol;
     28 -		else if (ev->x > selmon->ww - (int)TEXTW(stext))
     29 -			click = ClkStatusText;
     30 -		else
     31 -			click = ClkWinTitle;
     32 +		} else {
     33 +			do
     34 +				x += TEXTW(tags[i]);
     35 +			while (ev->x >= x && ++i < LENGTH(tags));
     36 +			if (i < LENGTH(tags)) {
     37 +				click = ClkTagBar;
     38 +				arg.ui = 1 << i;
     39 +			} else if (ev->x > selmon->ww - (int)TEXTW(stext))
     40 +				click = ClkStatusText;
     41 +			else
     42 +				click = ClkWinTitle;
     43 +		}
     44  	} else if ((c = wintoclient(ev->window))) {
     45  		focus(c);
     46  		restack(selmon);
     47 @@ -715,6 +718,9 @@ drawbar(Monitor *m)
     48  			urg |= c->tags;
     49  	}
     50  	x = 0;
     51 +	w = blw = TEXTW(m->ltsymbol);
     52 +	drw_setscheme(drw, scheme[SchemeNorm]);
     53 +	x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
     54  	for (i = 0; i < LENGTH(tags); i++) {
     55  		w = TEXTW(tags[i]);
     56  		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
     57 @@ -725,9 +731,6 @@ drawbar(Monitor *m)
     58  				urg & 1 << i);
     59  		x += w;
     60  	}
     61 -	w = blw = TEXTW(m->ltsymbol);
     62 -	drw_setscheme(drw, scheme[SchemeNorm]);
     63 -	x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
     64  
     65  	if ((w = m->ww - tw - x) > bh) {
     66  		if (m->sel) {
     67 -- 
     68 2.32.0
     69