diff options
author | Julian T <j@teule.nl> | 2018-09-12 14:21:51 +0200 |
---|---|---|
committer | Julian T <j@teule.nl> | 2018-09-12 14:21:51 +0200 |
commit | 5aa3a5519616bcd568a87a782510cae6f84f7d52 (patch) | |
tree | 6db7c501a6f6f217d1948ddc71b1d8379130aeed | |
parent | 3c4716742717a0a6bca4eb7393d72ee91e3a38e4 (diff) |
Added bstack layout
-rw-r--r-- | bstack.c | 29 | ||||
-rw-r--r-- | config.h | 3 |
2 files changed, 32 insertions, 0 deletions
diff --git a/bstack.c b/bstack.c new file mode 100644 index 0000000..ebae6fd --- /dev/null +++ b/bstack.c @@ -0,0 +1,29 @@ +static void +bstack(Monitor *m) { + int x, y, h, w, mh; + unsigned int i, n; + Client *c; + + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if(n == 0) + return; + /* master */ + c = nexttiled(m->clients); + mh = m->mfact * m->wh; + resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * c->bw, False); + if(--n == 0) + return; + /* tile stack */ + x = m->wx; + y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh; + w = m->ww / n; + h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh; + if(w < bh) + w = m->ww; + for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { + resize(c, x, y, /* remainder */ ((i + 1 == n) + ? m->wx + m->ww - x - 2 * c->bw : w - 2 * c->bw), h - 2 * c->bw, False); + if(w != m->ww) + x = c->x + WIDTH(c); + } +} @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include <X11/XF86keysym.h> +#include "bstack.c" /* appearance */ static const char *fonts[] = { @@ -44,6 +45,7 @@ static const Layout layouts[] = { { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, + { "TTT", bstack }, }; /* key definitions */ @@ -88,6 +90,7 @@ static Key keys[] = { { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, |