apply vertile layout patch

This commit is contained in:
korei999 2023-11-29 21:59:00 +02:00
parent 1d60a3aece
commit bd0503927b
5 changed files with 593 additions and 5 deletions

37
dwl.c
View file

@ -334,6 +334,7 @@ static void startdrag(struct wl_listener *listener, void *data);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void vertile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
@ -2698,6 +2699,42 @@ tile(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;