Add back other layouts

Added back master + monocle
This commit is contained in:
2026-06-28 19:32:48 -04:00
parent f52d70f982
commit 6c3dc371e3
+18 -11
View File
@@ -208,10 +208,14 @@ typedef struct {
#endif #endif
static void dwindle(Monitor *m); static void dwindle(Monitor *m);
static void master(Monitor *m);
static void monocle(Monitor *m);
static const Layout layouts[] = { static const Layout layouts[] = {
{"><>", NULL}, {"><>", NULL},
{"[T]", dwindle}, {"[T]", dwindle},
{"[M]", master},
{"[]", monocle},
}; };
/* dwindle tree */ /* dwindle tree */
@@ -515,8 +519,8 @@ static const char *custom_cfg_path;
/* attempt to encapsulate suck into one file */ /* attempt to encapsulate suck into one file */
#include "client.h" #include "client.h"
#include "ipc.h"
#include "ext-workspace.h" #include "ext-workspace.h"
#include "ipc.h"
/* function implementations */ /* function implementations */
void applybounds(Client *c, struct wlr_box *bbox) { void applybounds(Client *c, struct wlr_box *bbox) {
@@ -1184,6 +1188,10 @@ void createmon(struct wl_listener *listener, void *data) {
m->lt[0] = &layouts[li]; m->lt[0] = &layouts[li];
break; break;
} }
if (!strcmp(r->layout, "monocle") && layouts[li].arrange == monocle) {
m->lt[0] = &layouts[li];
break;
}
} }
m->lt[1] = &layouts[LENGTH(layouts) > 1 && m->lt[0] != &layouts[1]]; m->lt[1] = &layouts[LENGTH(layouts) > 1 && m->lt[0] != &layouts[1]];
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
@@ -3382,8 +3390,8 @@ static void master_arrange(Monitor *m, int ti) {
int stack_w = MAX(1, aw - master_w - e); int stack_w = MAX(1, aw - master_w - e);
if (master_c && !master_c->isfullscreen) if (master_c && !master_c->isfullscreen)
resize(master_c, resize(master_c, (struct wlr_box){m->w.x + e, m->w.y + e, master_w, ah},
(struct wlr_box){m->w.x + e, m->w.y + e, master_w, ah}, 0); 0);
int sh = MAX(1, (ah - (nstack - 1) * e) / nstack); int sh = MAX(1, (ah - (nstack - 1) * e) / nstack);
for (int i = 0; i < nstack; i++) for (int i = 0; i < nstack; i++)
@@ -3401,9 +3409,10 @@ static void master_arrange(Monitor *m, int ti) {
0); 0);
if (master_c && !master_c->isfullscreen) if (master_c && !master_c->isfullscreen)
resize(master_c, resize(
(struct wlr_box){m->w.x + e + stack_w + e, m->w.y + e, master_w, ah}, master_c,
0); (struct wlr_box){m->w.x + e + stack_w + e, m->w.y + e, master_w, ah},
0);
} }
} }
@@ -3413,14 +3422,12 @@ void master(Monitor *m) {
int ti = current_tag_idx(m); int ti = current_tag_idx(m);
master_arrange(m, ti); master_arrange(m, ti);
} }
void void monocle(Monitor *m) {
monocle(Monitor *m) {
Client *c, *sel = focustop(m); Client *c, *sel = focustop(m);
int n = 0, e; int n = 0, e;
wl_list_for_each(c, &clients, link) wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && !c->isfloating &&
if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) !c->isfullscreen) n++;
n++;
if (n == 0) if (n == 0)
return; return;