changeset 15:85763b447d0f

add dwindle_m layout
author paulo
date Mon, 09 Apr 2018 20:08:44 -0600
parents d65207f4021a
children cb5813c117e2
files layout.c
diffstat 1 files changed, 68 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/layout.c	Wed Sep 19 00:10:25 2012 -0700
     1.2 +++ b/layout.c	Mon Apr 09 20:08:44 2018 -0600
     1.3 @@ -68,6 +68,74 @@
     1.4  }
     1.5  
     1.6  static void
     1.7 +dwindle_m(void) {
     1.8 +	unsigned int i, j, n, nx, ny, nw, nh, mn, mr, mx, mw;
     1.9 +	unsigned int m = 2;
    1.10 +	//unsigned int m = nmaster;
    1.11 +	Client *c;
    1.12 +
    1.13 +	nx = wax;
    1.14 +	//ny = way + wah;
    1.15 +	ny = 0;
    1.16 +	nw = waw;
    1.17 +	nh = wah;
    1.18 +	mx = nx;
    1.19 +	mw = nw / m;
    1.20 +	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
    1.21 +		n++;
    1.22 +	mn = n / m;
    1.23 +	mr = n % m;
    1.24 +	for(i = 0, j = 0, c = clients; c; c = c->next)
    1.25 +		if(isvisible(c)) {
    1.26 +			if(c->isbanned)
    1.27 +				XMoveWindow(dpy, c->win, c->x, c->y);
    1.28 +			c->isbanned = False;
    1.29 +			if(c->isversatile)
    1.30 +				continue;
    1.31 +			c->ismax = False;
    1.32 +			if((i % 2 && nh / 2 > 2 * c->border)
    1.33 +				|| (!(i % 2) && nw / 2 > 2 * c->border))
    1.34 +			{
    1.35 +				if((j % m) == 0) {
    1.36 +					if(i < mn - (mr > 0 ? 0 : 1)) {
    1.37 +						if(i % 2)
    1.38 +							nh /= 2;
    1.39 +						else {
    1.40 +							nw /= 2;
    1.41 +							mw = nw / m;
    1.42 +						}
    1.43 +					}
    1.44 +					else if(mr)
    1.45 +						mw = nw / mr;
    1.46 +					if((i % 4) == 0)
    1.47 +						//ny -= nh;
    1.48 +						ny += (i == 0 ? way : nh);
    1.49 +					else if((i % 4) == 1)
    1.50 +						nx += nw;
    1.51 +					else if((i % 4) == 2)
    1.52 +						ny += nh;
    1.53 +					else
    1.54 +						//nx -= nw;
    1.55 +						nx += nw;
    1.56 +					i++;
    1.57 +				}
    1.58 +				mx = nx + (j % m) * mw;
    1.59 +				j++;
    1.60 +			}
    1.61 +			resize(c, mx, ny, mw - 2 * c->border, nh - 2 * c->border, False);
    1.62 +		}
    1.63 +		else {
    1.64 +			c->isbanned = True;
    1.65 +			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
    1.66 +		}
    1.67 +	if(!sel || !isvisible(sel)) {
    1.68 +		for(c = stack; c && !isvisible(c); c = c->snext);
    1.69 +		focus(c);
    1.70 +	}
    1.71 +	restack();
    1.72 +}
    1.73 +
    1.74 +static void
    1.75  spiral_h(void) {
    1.76  	unsigned int i, n, nx, ny, nw, nh;
    1.77  	Client *c;