diff options
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | dwm.c | 34 |
2 files changed, 36 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h index 63d328a..def5e8b 100644 --- a/config.def.h +++ b/config.def.h @@ -51,6 +51,7 @@ static const Layout layouts[] = { { "[M]", monocle }, { "|M|", centeredmaster }, { "||=", col }, + { "=[]", elit }, }; /* key definitions */ @@ -100,6 +101,7 @@ static const Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_u, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_o, setlayout, {.v = &layouts[4]} }, + { MODKEY, XK_e, setlayout, {.v = &layouts[5]} }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, @@ -168,6 +168,7 @@ static void detachstack(Client *c); static Monitor *dirtomon(int dir); static void drawbar(Monitor *m); static void drawbars(void); +static void elit(Monitor *m); static void enternotify(XEvent *e); static void expose(XEvent *e); static void focus(Client *c); @@ -835,6 +836,39 @@ drawbars(void) } void +elit(Monitor *m) +{ + unsigned int i, n, h, mw, my, ty, nslave; + Client *c; + + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if (n == 0) + return; + + if (n > m->nmaster) { + mw = m->nmaster ? m->ww * (1 - m->mfact) : 0; + nslave = n - m->nmaster; + } else { + mw = m->ww; + nslave = 0; + } + + for (i = ty = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { + if (i < nslave) { + h = (m->wh - ty) / (nslave - i); + resize(c, m->wx, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); + if (ty + HEIGHT(c) < m->wh) + ty += HEIGHT(c); + } else { + h = (m->wh - my) / (n - i); + resize(c, m->wx + (m->ww - mw), m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); + if (my + HEIGHT(c) < m->wh) + my += HEIGHT(c); + } + } +} + +void enternotify(XEvent *e) { Client *c; |