sites

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

dwm-gaps-xtile-6.0.diff (2842B)


      1 diff --git a/config.def.h b/config.def.h
      2 index ac895db..ef72871 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -9,6 +9,7 @@ static const char selbordercolor[]  = "#005577";
      6  static const char selbgcolor[]      = "#005577";
      7  static const char selfgcolor[]      = "#eeeeee";
      8  static const unsigned int borderpx  = 1;        /* border pixel of windows */
      9 +static const unsigned int gappx     = 1;        /* gap pixel between windows */
     10  static const unsigned int snap      = 32;       /* snap pixel */
     11  static const Bool showbar           = True;     /* False means no bar */
     12  static const Bool topbar            = True;     /* False means bottom bar */
     13 diff --git a/dwm.c b/dwm.c
     14 index 5dd2673..2c3268e 100644
     15 --- a/dwm.c
     16 +++ b/dwm.c
     17 @@ -1763,7 +1763,7 @@ void
     18  tile(Monitor *m) {
     19  	Client *c;
     20  	Area *ga = m->pertag->areas[m->pertag->curtag], *ma = ga + 1, *sa = ga + 2, *a;
     21 -	unsigned int n, i, w, h, ms, ss;
     22 +	unsigned int n, i, w, h, g, ms, ss;
     23  	float f;
     24  
     25  	/* print layout symbols */
     26 @@ -1778,23 +1778,24 @@ tile(Monitor *m) {
     27  	ma->n = MIN(n, m->nmaster), sa->n = n - ma->n;
     28  	/* calculate area rectangles */
     29  	f = ma->n == 0 ? 0 : (sa->n == 0 ? 1 : ga->fact / 2);
     30 +	g = ma->n == 0 || sa->n == 0 ? 0 : gappx;
     31  	if(ga->dir == DirHor || ga->dir == DirRotHor)
     32 -		ms = f * m->ww, ss = m->ww - ms,
     33 -		ma->x = ga->dir == DirHor ? 0 : ss, ma->y = 0, ma->fx = ma->x + ms, ma->fy = m->wh,
     34 -		sa->x = ga->dir == DirHor ? ms : 0, sa->y = 0, sa->fx = sa->x + ss, sa->fy = m->wh;
     35 +		ms = f * (m->ww - g), ss = m->ww - ms - g,
     36 +		ma->x = ga->dir == DirHor ? 0 : ss + g, ma->y = 0, ma->fx = ma->x + ms, ma->fy = m->wh,
     37 +		sa->x = ga->dir == DirHor ? ms + g: 0, sa->y = 0, sa->fx = sa->x + ss, sa->fy = m->wh;
     38  	else
     39 -		ms = f * m->wh, ss = m->wh - ms,
     40 -		ma->x = 0, ma->y = ga->dir == DirVer ? 0 : ss, ma->fx = m->ww, ma->fy = ma->y + ms,
     41 -		sa->x = 0, sa->y = ga->dir == DirVer ? ms : 0, sa->fx = m->ww, sa->fy = sa->y + ss;
     42 +		ms = f * (m->wh - g), ss = m->wh - ms - g,
     43 +		ma->x = 0, ma->y = ga->dir == DirVer ? 0 : ss + g, ma->fx = m->ww, ma->fy = ma->y + ms,
     44 +		sa->x = 0, sa->y = ga->dir == DirVer ? ms + g : 0, sa->fx = m->ww, sa->fy = sa->y + ss;
     45  	/* tile clients */
     46  	for(c = nexttiled(m->clients), i = 0; i < n; c = nexttiled(c->next), i++) {
     47  		a = ma->n > 0 ? ma : sa;
     48  		f = i == 0 || ma->n == 0 ? a->fact : 1, f /= --a->n + f;
     49 -		w = (a->dir == DirVer ? 1 : f) * (a->fx - a->x);
     50 -		h = (a->dir == DirHor ? 1 : f) * (a->fy - a->y);
     51 +		w = a->dir == DirVer ? a->fx - a->x : f * (a->fx - a->x - a->n * gappx);
     52 +		h = a->dir == DirHor ? a->fy - a->y : f * (a->fy - a->y - a->n * gappx);;
     53  		resize(c, m->wx + a->x, m->wy + a->y, w - 2 * c->bw, h - 2 * c->bw, False);
     54 -		a->x += a->dir == DirHor ? w : 0;
     55 -		a->y += a->dir == DirVer ? h : 0;
     56 +		a->x += a->dir == DirHor ? w + gappx : 0;
     57 +		a->y += a->dir == DirVer ? h + gappx : 0;
     58  	}
     59  }
     60