summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h2
-rw-r--r--dwm.c29
2 files changed, 31 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index 586dcb2..9c2b2c5 100644
--- a/config.def.h
+++ b/config.def.h
@@ -52,6 +52,7 @@ static const Layout layouts[] = {
{ "[M]", monocle },
{ "|M|", centeredmaster },
{ "TTT", bstack },
+ { "[][]=", tilewide },
};
/* key definitions */
@@ -95,6 +96,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_w, setlayout, {.v = &layouts[5]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
index 0e9c67a..ff5322a 100644
--- a/dwm.c
+++ b/dwm.c
@@ -215,6 +215,7 @@ static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
+static void tilewide(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
@@ -1879,6 +1880,34 @@ tile(Monitor *m)
}
void
+tilewide(Monitor *m)
+{
+ unsigned int i, n, w, h, mw, mx, ty;
+ 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 * m->mfact : 0;
+ else
+ mw = m->ww;
+ for (i = mx = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < m->nmaster) {
+ w = (mw - mx) / (MIN(n, m->nmaster) - i);
+ resize(c, m->wx + mx, m->wy, w - (2*c->bw), (m->wh - ty) - (2*c->bw), 0);
+ if (mx + WIDTH(c) < m->ww)
+ mx += WIDTH(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), 0);
+ if (ty + HEIGHT(c) < m->wh)
+ ty += HEIGHT(c);
+ }
+}
+
+void
togglebar(const Arg *arg)
{
selmon->showbar = !selmon->showbar;