dwm

my build of dwm
git clone git://git.hanetzok.net/dwm
Log | Files | Refs | README | LICENSE

commit 2d8363a939e7cb15d391019ee63aa6e58b8bf1a2
parent fb3749d41c2bfc6479b809cc92657896f01bbb5b
Author: Markus Hanetzok <markus@hanetzok.net>
Date:   Fri, 13 Dec 2024 01:31:11 +0100

apply tilewide patch

Diffstat:
Mconfig.def.h | 4+++-
Mdwm.c | 29+++++++++++++++++++++++++++++
Apatches/dwm-tilewide-6.4.diff | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 112 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h @@ -66,6 +66,7 @@ static const Layout layouts[] = { { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, + { "[][]=", tilewide }, }; /* key definitions */ @@ -109,9 +110,10 @@ static const Key keys[] = { { MODKEY, XK_p, togglescratch, {.ui = 2 } }, { MODKEY, XK_q, killclient, {0} }, { MODKEY|ShiftMask, XK_q, quit, {0} }, - { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, + { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_u, togglescratch, {.ui = 1 } }, + { MODKEY, XK_w, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_x, togglescratch, {.ui = 3 } }, { MODKEY, XK_y, togglescratch, {.ui = 0 } }, { MODKEY, XK_0, view, {.ui = ~0 } }, diff --git a/dwm.c b/dwm.c @@ -227,6 +227,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 toggleextrabar(const Arg *arg); static void togglefloating(const Arg *arg); @@ -1880,6 +1881,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) { selmon->showbar = !selmon->showbar; diff --git a/patches/dwm-tilewide-6.4.diff b/patches/dwm-tilewide-6.4.diff @@ -0,0 +1,80 @@ +From bcd178cc2321c824080dfaad14c9c18462b05c06 Mon Sep 17 00:00:00 2001 +From: sympodius <mail@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 +@@ -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 */ +@@ -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 +@@ -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); +@@ -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 +