summaryrefslogtreecommitdiffstats
path: root/dwl-patches/patches/mastercolumn
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2025-05-23 11:41:09 +0000
committerLeonard Kugis <leonard@kug.is>2025-05-23 11:41:09 +0000
commitc70505d7c7b7b48600f273357694b56ccf5d2a15 (patch)
tree21c27ac6ffced8d6d904e35bdb39baa5d685d829 /dwl-patches/patches/mastercolumn
downloaddotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.tar.gz
dotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.tar.bz2
dotfiles-c70505d7c7b7b48600f273357694b56ccf5d2a15.zip
Initial commitHEADmaster
Diffstat (limited to 'dwl-patches/patches/mastercolumn')
-rw-r--r--dwl-patches/patches/mastercolumn/README.md16
-rw-r--r--dwl-patches/patches/mastercolumn/mastercolumn-gaps.patch63
-rw-r--r--dwl-patches/patches/mastercolumn/mastercolumn.patch87
3 files changed, 166 insertions, 0 deletions
diff --git a/dwl-patches/patches/mastercolumn/README.md b/dwl-patches/patches/mastercolumn/README.md
new file mode 100644
index 0000000..14db13c
--- /dev/null
+++ b/dwl-patches/patches/mastercolumn/README.md
@@ -0,0 +1,16 @@
+### Description
+This patch adds a layout, `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 (as in the normal tile layout). It effectively differs from the default tile layout only in that master windows are arranged horizontally rather than vertically.
+
+For gaps, apply `mastercolumn-gaps.patch` on top of `mastercolumn.patch` and `gaps.patch`.
+
+### Download
+##### `mastercolumn.patch`
+- [git branch](/shivers/dwl/src/branch/mastercolumn)
+- [0.7](/dwl/dwl-patches/raw/branch/main/patches/mastercolumn/mastercolumn.patch)
+
+##### `mastercolumn-gaps.patch`
+- [git branch](/shivers/dwl/src/branch/mastercolumn-gaps)
+- [0.7](/dwl/dwl-patches/raw/branch/main/patches/mastercolumn/mastercolumn-gaps.patch)
+
+### Authors
+- [shivers](https://codeberg.org/shivers)
diff --git a/dwl-patches/patches/mastercolumn/mastercolumn-gaps.patch b/dwl-patches/patches/mastercolumn/mastercolumn-gaps.patch
new file mode 100644
index 0000000..943c4bd
--- /dev/null
+++ b/dwl-patches/patches/mastercolumn/mastercolumn-gaps.patch
@@ -0,0 +1,63 @@
+From b6f2ee09778cdea8a1450d16bcf24a8a75e10b40 Mon Sep 17 00:00:00 2001
+From: moe <moemmakki@gmail.com>
+Date: Tue, 16 Jul 2024 13:56:24 -0400
+Subject: [PATCH 1/1] add mastercolumn gaps
+
+---
+ dwl.c | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/dwl.c b/dwl.c
+index b121094..be33c01 100644
+--- a/dwl.c
++++ b/dwl.c
+@@ -1755,7 +1755,7 @@ unset_fullscreen:
+ void
+ mastercol(Monitor *m)
+ {
+- unsigned int mw, mx, ty;
++ unsigned int h, w, r, e = m->gaps, mw, mx, ty;
+ int i, n = 0;
+ Client *c;
+
+@@ -1764,23 +1764,30 @@ mastercol(Monitor *m)
+ n++;
+ if (n == 0)
+ return;
++ if (smartgaps == n)
++ e = 0;
+
+ if (n > m->nmaster)
+- mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
++ mw = m->nmaster ? (int)roundf((m->w.width + gappx*e) * m->mfact) : 0;
+ else
+ mw = m->w.width;
+- i = mx = ty = 0;
++ i = 0;
++ mx = ty = gappx*e;
+ 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;
++ r = MIN(n, m->nmaster) - i;
++ w = (mw - mx - gappx*e - gappx*e * (r - 1)) / r;
++ resize(c, (struct wlr_box){.x = m->w.x + mx, .y = m->w.y + gappx*e,
++ .width = w, .height = m->w.height - 2*gappx*e}, 0);
++ mx += c->geom.width + gappx*e;
+ } else {
++ r = n - i;
++ h = (m->w.height - ty - gappx*e - gappx*e * (r - 1)) / r;
+ 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;
++ .width = m->w.width - mw - gappx*e, .height = h}, 0);
++ ty += c->geom.height + gappx*e;
+ }
+ i++;
+ }
+--
+2.45.2
+
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
+