summaryrefslogtreecommitdiffstats
path: root/dwl-patches/patches/mastercolumn/mastercolumn-gaps.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dwl-patches/patches/mastercolumn/mastercolumn-gaps.patch')
-rw-r--r--dwl-patches/patches/mastercolumn/mastercolumn-gaps.patch63
1 files changed, 63 insertions, 0 deletions
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
+