diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2020-11-03 22:39:50 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2020-11-03 22:39:50 -0500 |
| commit | d0239d5374f460f0183b70b9e7a947c2a445dd2e (patch) | |
| tree | 1ba2f24db3946d9c46711d8795d27c768b4a9df7 /layouts.c | |
| parent | 66a186f755010c9674b2ac8a7e93b4cb626c5435 (diff) | |
| parent | 509e38c6c86a3078441cbcde61355e9d60cdf35d (diff) | |
| download | dwm-d0239d5374f460f0183b70b9e7a947c2a445dd2e.tar.gz dwm-d0239d5374f460f0183b70b9e7a947c2a445dd2e.tar.xz | |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'layouts.c')
| -rw-r--r-- | layouts.c | 67 |
1 files changed, 67 insertions, 0 deletions
@@ -25,3 +25,70 @@ grid(Monitor *m) { i++; } } + +void +fibonacci(Monitor *mon, int s) { + unsigned int i, n, nx, ny, nw, nh; + Client *c; + + for(n = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next), n++); + if(n == 0) + return; + + nx = mon->wx; + ny = 0; + nw = mon->ww; + nh = mon->wh; + + for(i = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next)) { + if((i % 2 && nh / 2 > 2 * c->bw) + || (!(i % 2) && nw / 2 > 2 * c->bw)) { + if(i < n - 1) { + if(i % 2) + nh /= 2; + else + nw /= 2; + if((i % 4) == 2 && !s) + nx += nw; + else if((i % 4) == 3 && !s) + ny += nh; + } + if((i % 4) == 0) { + if(s) + ny += nh; + else + ny -= nh; + } + else if((i % 4) == 1) + nx += nw; + else if((i % 4) == 2) + ny += nh; + else if((i % 4) == 3) { + if(s) + nx += nw; + else + nx -= nw; + } + if(i == 0) + { + if(n != 1) + nw = mon->ww * mon->mfact; + ny = mon->wy; + } + else if(i == 1) + nw = mon->ww - nw; + i++; + } + resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False); + } +} + +void +dwindle(Monitor *mon) { + fibonacci(mon, 1); +} + +void +spiral(Monitor *mon) { + fibonacci(mon, 0); +} |
