sites

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

dwm-noborder-6.1.diff (2347B)


      1 diff --git a/dwm.c b/dwm.c
      2 index 0362114..e3209e5 100644
      3 --- a/dwm.c
      4 +++ b/dwm.c
      5 @@ -393,9 +393,24 @@ arrange(Monitor *m)
      6  void
      7  arrangemon(Monitor *m)
      8  {
      9 +	int n = 0;
     10 +	Client *c;
     11  	strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
     12 -	if (m->lt[m->sellt]->arrange)
     13 -		m->lt[m->sellt]->arrange(m);
     14 +	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
     15 +	if ((m->lt[m->sellt]->arrange != monocle && n > 1) || !m->lt[m->sellt]->arrange) {
     16 +		for (c = m->clients; c; c = c->next) {
     17 +			if (ISVISIBLE(c) && (!m->lt[m->sellt]->arrange || !c->isfloating) && (c->bw != borderpx)) {
     18 +				c->oldbw = c->bw;
     19 +				c->bw = borderpx;
     20 +				resizeclient(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw));
     21 +			}
     22 +		}
     23 +		if (m->lt[m->sellt]->arrange) {
     24 +			m->lt[m->sellt]->arrange(m);
     25 +		}
     26 +	} else {
     27 +		monocle(m);
     28 +	}
     29  }
     30  
     31  void
     32 @@ -1123,10 +1138,19 @@ monocle(Monitor *m)
     33  	for (c = m->clients; c; c = c->next)
     34  		if (ISVISIBLE(c))
     35  			n++;
     36 -	if (n > 0) /* override layout symbol */
     37 +	if (n > 0 && m->lt[m->sellt]->arrange == monocle) /* override layout symbol */
     38  		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
     39 -	for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
     40 -		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
     41 +	for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
     42 +		// I'm not sure, but calling resize with the border width subtractions
     43 +		// fixes a glitch where windows would not redraw until they were
     44 +		// manually resized after restarting dwm.
     45 +		resize(c, m->wx, m->wy, m->ww - (2 * c->bw), m->wh - (2 * c->bw), False);
     46 +		if (c->bw) {
     47 +			c->oldbw = c->bw;
     48 +			c->bw = 0;
     49 +			resizeclient(c, m->wx, m->wy, m->ww, m->wh);
     50 +		}
     51 +	}
     52  }
     53  
     54  void
     55 @@ -1706,9 +1730,14 @@ togglefloating(const Arg *arg)
     56  	if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
     57  		return;
     58  	selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
     59 -	if (selmon->sel->isfloating)
     60 +	if (selmon->sel->isfloating) {
     61 +		if (selmon->sel->bw != borderpx) {
     62 +			selmon->sel->oldbw = selmon->sel->bw;
     63 +			selmon->sel->bw = borderpx;
     64 +		}
     65  		resize(selmon->sel, selmon->sel->x, selmon->sel->y,
     66 -		       selmon->sel->w, selmon->sel->h, 0);
     67 +		       selmon->sel->w - selmon->sel->bw * 2, selmon->sel->h - selmon->sel->bw * 2, 0);
     68 +	}
     69  	arrange(selmon);
     70  }
     71