From 6c3dc371e37f46a5dd43d3d2b7ae25b582a50a2a Mon Sep 17 00:00:00 2001 From: HuntedByTheIRS Date: Sun, 28 Jun 2026 19:32:48 -0400 Subject: [PATCH] Add back other layouts Added back master + monocle --- src/peachwm.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/peachwm.c b/src/peachwm.c index 65aabc8..119a654 100644 --- a/src/peachwm.c +++ b/src/peachwm.c @@ -208,10 +208,14 @@ typedef struct { #endif static void dwindle(Monitor *m); +static void master(Monitor *m); +static void monocle(Monitor *m); static const Layout layouts[] = { {"><>", NULL}, {"[T]", dwindle}, + {"[M]", master}, + {"[]", monocle}, }; /* dwindle tree */ @@ -515,8 +519,8 @@ static const char *custom_cfg_path; /* attempt to encapsulate suck into one file */ #include "client.h" -#include "ipc.h" #include "ext-workspace.h" +#include "ipc.h" /* function implementations */ 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]; 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]]; 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); if (master_c && !master_c->isfullscreen) - resize(master_c, - (struct wlr_box){m->w.x + e, m->w.y + e, master_w, ah}, 0); + resize(master_c, (struct wlr_box){m->w.x + e, m->w.y + e, master_w, ah}, + 0); int sh = MAX(1, (ah - (nstack - 1) * e) / nstack); for (int i = 0; i < nstack; i++) @@ -3401,9 +3409,10 @@ static void master_arrange(Monitor *m, int ti) { 0); if (master_c && !master_c->isfullscreen) - resize(master_c, - (struct wlr_box){m->w.x + e + stack_w + e, m->w.y + e, master_w, ah}, - 0); + resize( + master_c, + (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); master_arrange(m, ti); } -void -monocle(Monitor *m) { +void monocle(Monitor *m) { Client *c, *sel = focustop(m); int n = 0, e; - wl_list_for_each(c, &clients, link) - if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) - n++; + wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && !c->isfloating && + !c->isfullscreen) n++; if (n == 0) return;