diff --git a/config.def.h b/config.def.h index e9e985a..9a9d6d1 100644 --- a/config.def.h +++ b/config.def.h @@ -65,6 +65,7 @@ static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, { "[M]", monocle }, + { "[v]", vertile }, { "><>", NULL } /* no layout function means floating behavior */ }; @@ -72,12 +73,12 @@ static const Layout layouts[] = { * The order in which monitors are defined determines their position. * Non-configured monitors are always added to the left. */ static const MonitorRule monrules[] = { - /* name mfact nmaster scale layout rotate/reflect x y resx resy rate adaptive custom*/ - /* example of a HiDPI laptop monitor at 120Hz: - { "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 120.000, 1, 0 }, + /* name mfact nmaster scale layout rotate/reflect x y */ + /* example of a HiDPI laptop monitor: + { "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, */ /* defaults */ - { NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 120.000999, 0, 0 }, + { NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, }; diff --git a/dwl.c b/dwl.c index b6c98ea..e7f68d9 100644 --- a/dwl.c +++ b/dwl.c @@ -3141,6 +3141,42 @@ vertile(Monitor *m) } } +void +vertile(Monitor *m) +{ + unsigned int i, n = 0, h, mh, my, ty, draw_borders = 1; + Client *c; + + wl_list_for_each(c, &clients, link) + if (VISIBLEON(c, m) && !c->isfloating) + n++; + if (n == 0) + return; + + if (n == smartborders) + draw_borders = 0; + + 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, (struct wlr_box) { .x = m->w.x, .y = m->w.y + my, .width = m->w.width, .height = h }, 0); + my += c->geom.height; + } else { + h = ( m->w.height - ty ) / (n - i); + resize(c, (struct wlr_box) { .x = m->w.x, .y = m->w.y + ty, .width = m->w.width, .height = h }, 0); + ty += c->geom.height; + } + i++; + } +} + void togglebar(const Arg *arg) { DwlIpcOutput *ipc_output;