diff options
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -125,6 +125,7 @@ struct Monitor { unsigned int seltags; unsigned int sellt; unsigned int tagset[2]; + int rmaster; int showbar; int topbar; Client *clients; @@ -220,6 +221,7 @@ static void tagtoright(const Arg *arg); static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); +static void togglermaster(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); static void unfocus(Client *c, int setfocus); @@ -661,6 +663,7 @@ createmon(void) m->tagset[0] = m->tagset[1] = 1; m->mfact = mfact; m->nmaster = nmaster; + m->rmaster = rmaster; m->showbar = showbar; m->topbar = topbar; m->gappx = gappx; @@ -1938,18 +1941,22 @@ tile(Monitor *m) return; if (n > m->nmaster) - mw = m->nmaster ? m->ww * m->mfact : 0; + mw = m->nmaster + ? m->ww * (m->rmaster ? 1.0 - m->mfact : m->mfact) + : 0; else mw = m->ww - m->gappx; for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) if (i < m->nmaster) { h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx; - resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0); + resize(c, m->rmaster ? m->wx + m->ww - mw : m->wx, + m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); if (my + HEIGHT(c) + m->gappx < m->wh) my += HEIGHT(c) + m->gappx; } else { h = (m->wh - ty) / (n - i) - m->gappx; - resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0); + resize(c, m->rmaster ? m->wx : m->wx + mw, m->wy + ty, + m->ww - mw - (2*c->bw), h - (2*c->bw), 0); if (ty + HEIGHT(c) + m->gappx < m->wh) ty += HEIGHT(c) + m->gappx; } @@ -1983,6 +1990,16 @@ togglefloating(const Arg *arg) } void +togglermaster(const Arg *arg) +{ + selmon->rmaster = !selmon->rmaster; + /* now mfact represents the left factor */ + selmon->mfact = 1.0 - selmon->mfact; + if (selmon->lt[selmon->sellt]->arrange) + arrange(selmon); +} + +void toggletag(const Arg *arg) { unsigned int newtags; |