diff --git a/patches/README.md b/patches/README.md new file mode 100644 index 0000000..5ed193a --- /dev/null +++ b/patches/README.md @@ -0,0 +1,9 @@ +### Description +This patch adds an extra layout to dwl called `mastercol` in which the windows in the master area are arranged in columns of equal size. The number of columns is always nmaster + 1, and the last column is a stack of leftover windows just like the normal tile layout. It effectively acts like the default tiling mode, except provides for vertical instead of horizontal master windows. + +### Download +- [git branch](https://codeberg.org/dsst/dwl/src/branch/mastercolumn) +- [2024-07-13](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/mastercolumn/mastercolumn.patch) + +### Authors +- [dsst](https://codeberg.org/dsst) diff --git a/patches/mastercolumn/mastercolumn.patch b/patches/mastercolumn/mastercolumn.patch new file mode 100644 index 0000000..a58f5e3 --- /dev/null +++ b/patches/mastercolumn/mastercolumn.patch @@ -0,0 +1,86 @@ +From 64ef30f1970de25542dfcf1ed617d354558c69eb Mon Sep 17 00:00:00 2001 +From: moe +Date: Sat, 13 Jul 2024 13:02:34 -0400 +Subject: [PATCH] init mastercolumn + +--- + config.def.h | 2 ++ + dwl.c | 35 +++++++++++++++++++++++++++++++++++ + 2 files changed, 37 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 dc0437e..9e345d6 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -297,6 +297,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); +@@ -1700,6 +1701,40 @@ 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.45.2 +