aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorConnor Lane Smith2011-10-28 23:45:12 +0100
committerConnor Lane Smith2011-10-28 23:45:12 +0100
commit257b1e58c629ca87122532a7a1adbdf8e75fa523 (patch)
tree7dd63f13f0b1edab4a4c0aca8ae25d51a25bdc0c
parentd9ce422788f8f1080c0f8aa167518cd37ef9ed3f (diff)
downloadaur-257b1e58c629ca87122532a7a1adbdf8e75fa523.tar.gz
improve tile spacing
-rw-r--r--dwm.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/dwm.c b/dwm.c
index a58eb2a4c930..cce215a9c63d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1659,23 +1659,26 @@ textnw(const char *text, unsigned int len) {
void
tile(Monitor *m) {
- unsigned int i, n, mw, mh, tw, th;
+ unsigned int i, n, h, mw, my, ty;
Client *c;
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if(n == 0)
return;
- mh = (n > m->nmaster) ? m->wh / m->nmaster : m->wh / n;
mw = (n > m->nmaster) ? m->ww * m->mfact : m->ww;
- th = (n > m->nmaster) ? m->wh / (n - m->nmaster) : 0;
- tw = m->ww - mw;
- for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
- if(i < m->nmaster)
- resize(c, m->wx, m->wy + (i*mh), mw - (2*c->bw), mh - (2*c->bw), False);
- else
- resize(c, m->wx + mw, m->wy + ((i - m->nmaster)*th), tw - (2*c->bw), th - (2*c->bw), False);
+ for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if(i < m->nmaster) {
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+ resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
+ my += HEIGHT(c);
+ }
+ else {
+ h = (m->wh - ty) / (n - i);
+ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
+ ty += HEIGHT(c);
+ }
}
void