diff options
Diffstat (limited to 'dwl-patches/patches/mastercolumn/mastercolumn.patch')
-rw-r--r-- | dwl-patches/patches/mastercolumn/mastercolumn.patch | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/dwl-patches/patches/mastercolumn/mastercolumn.patch b/dwl-patches/patches/mastercolumn/mastercolumn.patch new file mode 100644 index 0000000..425e414 --- /dev/null +++ b/dwl-patches/patches/mastercolumn/mastercolumn.patch @@ -0,0 +1,87 @@ +From eb0c6ff53ba823f26d13f18627a084959c353627 Mon Sep 17 00:00:00 2001 +From: moe <moemmakki@gmail.com> +Date: Sat, 10 Aug 2024 15:58:15 -0400 +Subject: [PATCH] add mastercolumn layout + +--- + config.def.h | 2 ++ + dwl.c | 36 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 38 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 22d2171..68b27a7 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -34,6 +34,7 @@ static const Layout layouts[] = { + { "[]=", tile }, + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "||=", mastercol }, + }; + + /* monitors */ +@@ -139,6 +140,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, XKB_KEY_c, 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 a2711f6..49f65ba 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -301,6 +301,7 @@ static int keyrepeat(void *data); + static void killclient(const Arg *arg); + static void locksession(struct wl_listener *listener, void *data); + static void mapnotify(struct wl_listener *listener, void *data); ++static void mastercol(Monitor *m); + static void maximizenotify(struct wl_listener *listener, void *data); + static void monocle(Monitor *m); + static void motionabsolute(struct wl_listener *listener, void *data); +@@ -1748,6 +1749,41 @@ unset_fullscreen: + } + } + ++void ++mastercol(Monitor *m) ++{ ++ unsigned int mw, mx, ty; ++ int i, n = 0; ++ Client *c; ++ ++ wl_list_for_each(c, &clients, link) ++ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) ++ n++; ++ if (n == 0) ++ return; ++ ++ if (n > m->nmaster) ++ mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0; ++ else ++ mw = m->w.width; ++ i = mx = ty = 0; ++ wl_list_for_each(c, &clients, link) { ++ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) ++ continue; ++ if (i < m->nmaster) { ++ resize(c, (struct wlr_box){.x = m->w.x + mx, .y = m->w.y, ++ .width = (mw - mx) / (MIN(n, m->nmaster) - i), .height = m->w.height}, 0); ++ mx += c->geom.width; ++ } else { ++ resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty, ++ .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0); ++ ty += c->geom.height; ++ } ++ i++; ++ } ++} ++ ++ + void + maximizenotify(struct wl_listener *listener, void *data) + { +-- +2.46.0 + |