summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h2
-rw-r--r--dwl.c35
2 files changed, 37 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index 089aa37..2a955d6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -22,6 +22,7 @@ static const Layout layouts[] = {
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "|v|", vertile },
};
/* monitors
@@ -82,6 +83,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_T, setlayout, {.v = &layouts[3]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
diff --git a/dwl.c b/dwl.c
index b898537..92eaf22 100644
--- a/dwl.c
+++ b/dwl.c
@@ -284,6 +284,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 vertile(Monitor *m);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg);
@@ -2232,6 +2233,40 @@ tile(Monitor *m)
}
void
+vertile(Monitor *m)
+{
+ unsigned int i, n = 0, h, mh, my, ty;
+ Client *c;
+
+ wl_list_for_each(c, &clients, link)
+ if (VISIBLEON(c, m) && !c->isfloating)
+ n++;
+ if (n == 0)
+ return;
+
+ if (n > m->nmaster)
+ ty = mh = m->nmaster ? m->w.height * m->mfact : 0;
+ else
+ ty = mh = m->w.height;
+ i = my = 0;
+ wl_list_for_each(c, &clients, link) {
+ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
+ continue;
+ if (i < m->nmaster) {
+ h = ( mh - my ) / (MIN(n, m->nmaster) - i);
+ resize(c, m->w.x, m->w.y + my, m->w.width, h, 0);
+ my += c->geom.height;
+ } else {
+ h = ( m->w.height - ty ) / (n - i);
+ resize(c, m->w.x, m->w.y + ty, m->w.width, h, 0);
+ ty += c->geom.height;
+ }
+ i++;
+ }
+}
+
+
+void
togglefloating(const Arg *arg)
{
Client *sel = selclient();