sites

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

dwm-leftlayout-20180524-c8e9479.diff (1829B)


      1 From 73f9b8a4563ff89953459feae5bdbda8bdff94e7 Mon Sep 17 00:00:00 2001
      2 From: Christopher Drelich <cd@cdrakka.com>
      3 Date: Thu, 24 May 2018 20:40:58 -0400
      4 Subject: [PATCH] Moved layout symbol to left-hand side.
      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 bb95e26..9a57082 100644
     12 --- a/dwm.c
     13 +++ b/dwm.c
     14 @@ -431,18 +431,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 - 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 - 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 @@ -714,6 +717,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 @@ -724,9 +730,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 - sw - x) > bh) {
     66  		if (m->sel) {
     67 -- 
     68 2.7.4
     69