[wiki] [sites] [dwm][patch][tilewide] Updating tilewide patch for dwm 6.4 || sympodius
commit 7cd867d4e6a30efcb6ec80be64000f4d78d469f3
Author: sympodius <mail_AT_sympodius.net>
Date: Sat Mar 11 18:53:02 2023 +0000
[dwm][patch][tilewide] Updating tilewide patch for dwm 6.4
This also includes a separate patch for useless gap users.
diff --git a/dwm.suckless.org/patches/tilewide/dwm-tilewide-6.4-for-uselessgap-20211119-58414bee958f2.diff b/dwm.suckless.org/patches/tilewide/dwm-tilewide-6.4-for-uselessgap-20211119-58414bee958f2.diff
new file mode 100644
index 00000000..8c53d659
--- /dev/null
+++ b/dwm.suckless.org/patches/tilewide/dwm-tilewide-6.4-for-uselessgap-20211119-58414bee958f2.diff
_AT_@ -0,0 +1,81 @@
+From 6a88229721cabfd6e288c31e8a539f68684f4761 Mon Sep 17 00:00:00 2001
+From: sympodius <mail_AT_sympodius.net>
+Date: Fri, 10 Mar 2023 21:57:10 +0000
+Subject: [PATCH] Patch tested for 20211119-58414bee958f2 release of useless
+ gap.
+
+---
+ config.def.h | 2 ++
+ dwm.c | 29 +++++++++++++++++++++++++++++
+ 2 files changed, 31 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 79ae7cf..e3e9708 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -43,6 +43,7 @@ static const Layout layouts[] = {
+ { "[]=", tile }, /* first entry is default */
+ { "><>", NULL }, /* no layout function means floating behavior */
+ { "[M]", monocle },
++ { "[][]=", tilewide },
+ };
+
+ /* key definitions */
+_AT_@ -78,6 +79,7 @@ static const Key keys[] = {
+ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
+ { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
++ { MODKEY, XK_w, setlayout, {.v = &layouts[3]} },
+ { MODKEY, XK_space, setlayout, {0} },
+ { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY, XK_0, view, {.ui = ~0 } },
+diff --git a/dwm.c b/dwm.c
+index a747f60..87bbc23 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -209,6 +209,7 @@ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *m);
++static void tilewide(Monitor *m);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
+ static void toggletag(const Arg *arg);
+_AT_@ -1728,6 +1729,34 @@ tile(Monitor *m)
+ }
+ }
+
++void
++tilewide(Monitor *m)
++{
++ unsigned int i, n, w, h, mw, mx, ty;
++ Client *c;
++
++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
++ if (n == 0)
++ return;
++
++ if (n > m->nmaster)
++ mw = m->nmaster ? m->ww * m->mfact : 0;
++ else
++ mw = m->ww;
++ for (i = mx = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++ if (i < m->nmaster) {
++ w = (mw - mx) / (MIN(n, m->nmaster) - i);
++ resize(c, m->wx + mx, m->wy, w - (2*c->bw) + (n > 1 ? gappx : 0), (m->wh - ty) - (2*c->bw), 0);
++ if (mx + WIDTH(c) < m->ww)
++ mx += WIDTH(c);
++ } else {
++ h = (m->wh - ty) / (n - i);
++ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
++ if (ty + HEIGHT(c) < m->wh)
++ ty += HEIGHT(c);
++ }
++}
++
+ void
+ togglebar(const Arg *arg)
+ {
+--
+2.39.2
+
diff --git a/dwm.suckless.org/patches/tilewide/dwm-tilewide-6.4.diff b/dwm.suckless.org/patches/tilewide/dwm-tilewide-6.4.diff
new file mode 100644
index 00000000..a976a1cb
--- /dev/null
+++ b/dwm.suckless.org/patches/tilewide/dwm-tilewide-6.4.diff
_AT_@ -0,0 +1,80 @@
+From bcd178cc2321c824080dfaad14c9c18462b05c06 Mon Sep 17 00:00:00 2001
+From: sympodius <mail_AT_sympodius.net>
+Date: Fri, 10 Mar 2023 20:56:49 +0000
+Subject: [PATCH] Patch tested for 6.4 release.
+
+---
+ config.def.h | 2 ++
+ dwm.c | 29 +++++++++++++++++++++++++++++
+ 2 files changed, 31 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..bbb5b1a 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -42,6 +42,7 @@ static const Layout layouts[] = {
+ { "[]=", tile }, /* first entry is default */
+ { "><>", NULL }, /* no layout function means floating behavior */
+ { "[M]", monocle },
++ { "[][]=", tilewide },
+ };
+
+ /* key definitions */
+_AT_@ -77,6 +78,7 @@ static const Key keys[] = {
+ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
+ { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
++ { MODKEY, XK_w, setlayout, {.v = &layouts[3]} },
+ { MODKEY, XK_space, setlayout, {0} },
+ { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY, XK_0, view, {.ui = ~0 } },
+diff --git a/dwm.c b/dwm.c
+index c2bd871..93a5156 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -209,6 +209,7 @@ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static void tile(Monitor *m);
++static void tilewide(Monitor *m);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
+ static void toggletag(const Arg *arg);
+_AT_@ -1704,6 +1705,34 @@ tile(Monitor *m)
+ }
+ }
+
++void
++tilewide(Monitor *m)
++{
++ unsigned int i, n, w, h, mw, mx, ty;
++ Client *c;
++
++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
++ if (n == 0)
++ return;
++
++ if (n > m->nmaster)
++ mw = m->nmaster ? m->ww * m->mfact : 0;
++ else
++ mw = m->ww;
++ for (i = mx = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++ if (i < m->nmaster) {
++ w = (mw - mx) / (MIN(n, m->nmaster) - i);
++ resize(c, m->wx + mx, m->wy, w - (2*c->bw), (m->wh - ty) - (2*c->bw), 0);
++ if (mx + WIDTH(c) < m->ww)
++ mx += WIDTH(c);
++ } else {
++ h = (m->wh - ty) / (n - i);
++ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
++ if (ty + HEIGHT(c) < m->wh)
++ ty += HEIGHT(c);
++ }
++}
++
+ void
+ togglebar(const Arg *arg)
+ {
+--
+2.39.2
+
diff --git a/dwm.suckless.org/patches/tilewide/index.md b/dwm.suckless.org/patches/tilewide/index.md
index cec51ac3..872e2a7d 100644
--- a/dwm.suckless.org/patches/tilewide/index.md
+++ b/dwm.suckless.org/patches/tilewide/index.md
_AT_@ -19,8 +19,13 @@ By default, `tilewide` can be selected with [Alt]+[w].
Download
--------
+* [dwm-tilewide-6.4.diff](dwm-tilewide-6.4.diff)
* [dwm-tilewide-6.3.diff](dwm-tilewide-6.3.diff)
+Download for Users of Useless Gap
+---------------------------------
+* [dwm-tilewide-6.4-for-uselessgap-20211119-58414bee958f2](dwm-tilewide-6.4-for-uselessgap-20211119-58414bee958f2) If you have already applied [dwm-uselessgap-20211119-58414bee958f2.diff](../uselessgap/dwm-uselessgap-20211119-58414bee958f2.diff), use this patch instead of either of the ones above. Applying this patch after [dwm-uselessgap-20211119-58414bee958f2.diff](../uselessgap/dwm-uselessgap-20211119-58414bee958f2.diff) will prevent the inner vertical gap between the master and stack being wider than the rest of the gaps in the `tilewide` layout.
+
Author
------
* John Urquhart Ferguson (sympodius) - <mail_AT_sympodius.net>
Received on Sat Mar 11 2023 - 20:00:00 CET
This archive was generated by hypermail 2.3.0
: Sat Mar 11 2023 - 20:00:57 CET