diff --git a/_STALE_PATCHES/bottomstack.md b/_STALE_PATCHES/bottomstack.md deleted file mode 100644 index f826b7b..0000000 --- a/_STALE_PATCHES/bottomstack.md +++ /dev/null @@ -1,27 +0,0 @@ -### Description -bstack and bstackhoriz are two stack layouts for dwl. -### Scheme -``` -bstack (TTT) bstackhoriz (===) -+-----------------+ +-----------------+ -| | | | -| | | | -| | | | -+-----+-----+-----+ +-----------------+ -| | | | +-----------------+ -| | | | +-----------------+ -+-----+-----+-----+ +-----------------+ -``` -### Changelog - -2023-11-24: -- Remove gaps between windows. - -### Download -- [2023-11-24](https://github.com/djpohly/dwl/compare/main...wochap:bottomstack.patch) -- [2023-06-21](https://github.com/djpohly/dwl/compare/main...Abanoub8:bottomstack.patch) -- [2021-10-06](https://github.com/djpohly/dwl/compare/main...DanielMowitz:bottomstack.patch) - -### Authors -- [DanielMowitz](https://github.com/DanielMowitz) -- [Abanoub8](https://github.com/Abanoub8) \ No newline at end of file diff --git a/bottomstack/bottomstack.patch b/bottomstack/bottomstack.patch new file mode 100644 index 0000000..dde9351 --- /dev/null +++ b/bottomstack/bottomstack.patch @@ -0,0 +1,185 @@ +From e0774958da4e9dc72fd3b0e7de7732e8c0c52449 Mon Sep 17 00:00:00 2001 +From: wochap +Date: Wed, 22 Nov 2023 19:02:09 -0500 +Subject: [PATCH 1/2] [PATCH 1/2] apply main...Abanoub8:bottomstack.patch + +--- + config.def.h | 4 +++ + dwl.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 88 insertions(+) + +diff --git a/config.def.h b/config.def.h +index db0babc..0be86bc 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -33,6 +33,8 @@ static const Layout layouts[] = { + { "[]=", tile }, + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "TTT", bstack }, ++ { "===", bstackhoriz }, + }; + + /* monitors */ +@@ -132,6 +134,8 @@ 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_u, setlayout, {.v = &layouts[3]} }, ++ { MODKEY, XKB_KEY_o, setlayout, {.v = &layouts[4]} }, + { 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 ef27a1d..49209dc 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -51,6 +51,7 @@ + #include + #include + #include ++#include + #include + #include + #ifdef XWAYLAND +@@ -327,6 +328,8 @@ static Monitor *xytomon(double x, double y); + static void xytonode(double x, double y, struct wlr_surface **psurface, + Client **pc, LayerSurface **pl, double *nx, double *ny); + static void zoom(const Arg *arg); ++static void bstack(Monitor *m); ++static void bstackhoriz(Monitor *m); + + /* variables */ + static const char broken[] = "broken"; +@@ -2902,3 +2905,84 @@ main(int argc, char *argv[]) + usage: + die("Usage: %s [-v] [-d] [-s startup command]", argv[0]); + } ++ ++static void ++bstack(Monitor *m) ++{ ++ int w, h, mh, mx, tx, ty, tw; ++ unsigned int i, n = 0; ++ Client *c; ++ ++ wl_list_for_each(c, &clients, link) ++ if (VISIBLEON(c, m) && !c->isfloating) ++ n++; ++ if (n == 0) ++ return; ++ ++ if (n > m->nmaster) { ++ mh = m->nmaster ? m->mfact * m->w.height : 0; ++ tw = m->w.width / (n - m->nmaster); ++ ty = m->w.y + mh; ++ } else { ++ mh = m->w.height; ++ tw = m->w.width; ++ ty = m->w.y; ++ } ++ ++ i = mx = 0; ++ tx = m-> w.x; ++ wl_list_for_each(c, &clients, link) { ++ if (!VISIBLEON(c, m) || c->isfloating) ++ continue; ++ if (i < m->nmaster) { ++ w = (m->w.width - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, (struct wlr_box) { .x = m->w.x + mx, .y = m->w.y, .width = w - (2 * c->bw), .height = mh - (2 * c->bw) }, 0); ++ mx += c->geom.width; ++ } else { ++ h = m->w.height - mh; ++ resize(c, (struct wlr_box) { .x = tx, .y = ty, .width = tw - (2 * c->bw), .height = h - (2 * c->bw) }, 0); ++ if (tw != m->w.width) ++ tx += c->geom.width; ++ } ++ i++; ++ } ++} ++ ++static void ++bstackhoriz(Monitor *m) { ++ int w, mh, mx, tx, ty, th; ++ unsigned int i, n = 0; ++ Client *c; ++ ++ wl_list_for_each(c, &clients, link) ++ if (VISIBLEON(c, m) && !c->isfloating) ++ n ++; ++ if (n == 0) ++ return; ++ ++ if (n > m->nmaster) { ++ mh = m->nmaster ? m->mfact * m->w.height : 0; ++ th = (m->w.height - mh) / (n - m->nmaster); ++ ty = m->w.y + mh; ++ } else { ++ th = mh = m->w.height; ++ ty = m->w.y; ++ } ++ ++ i = mx = 0; ++ tx = m-> w.x; ++ wl_list_for_each(c, &clients, link) { ++ if (!VISIBLEON(c,m) || c->isfloating) ++ continue; ++ if (i < m->nmaster) { ++ w = (m->w.width - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, (struct wlr_box) { .x = m->w.x + mx, .y = m->w.y, .width = w - (2 * c->bw), .height = mh - (2 * c->bw) }, 0); ++ mx += c->geom.width; ++ } else { ++ resize(c, (struct wlr_box) { .x = tx, .y = ty, .width = m->w.width - (2 * c->bw), .height = th - (2 * c->bw) }, 0); ++ if (th != m->w.height) ++ ty += c->geom.height; ++ } ++ i++; ++ } ++} +-- +2.42.0 + + +From c28586c8b2328205bd578bf48110676d5ed04b7e Mon Sep 17 00:00:00 2001 +From: wochap +Date: Wed, 22 Nov 2023 19:03:00 -0500 +Subject: [PATCH 2/2] [PATCH 2/2] fix main...Abanoub8:bottomstack.patch, remove + gaps + +--- + dwl.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/dwl.c b/dwl.c +index 49209dc..6ad9187 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -2936,11 +2936,11 @@ bstack(Monitor *m) + continue; + if (i < m->nmaster) { + w = (m->w.width - mx) / (MIN(n, m->nmaster) - i); +- resize(c, (struct wlr_box) { .x = m->w.x + mx, .y = m->w.y, .width = w - (2 * c->bw), .height = mh - (2 * c->bw) }, 0); ++ resize(c, (struct wlr_box) { .x = m->w.x + mx, .y = m->w.y, .width = w, .height = mh }, 0); + mx += c->geom.width; + } else { + h = m->w.height - mh; +- resize(c, (struct wlr_box) { .x = tx, .y = ty, .width = tw - (2 * c->bw), .height = h - (2 * c->bw) }, 0); ++ resize(c, (struct wlr_box) { .x = tx, .y = ty, .width = tw, .height = h }, 0); + if (tw != m->w.width) + tx += c->geom.width; + } +@@ -2976,10 +2976,10 @@ bstackhoriz(Monitor *m) { + continue; + if (i < m->nmaster) { + w = (m->w.width - mx) / (MIN(n, m->nmaster) - i); +- resize(c, (struct wlr_box) { .x = m->w.x + mx, .y = m->w.y, .width = w - (2 * c->bw), .height = mh - (2 * c->bw) }, 0); ++ resize(c, (struct wlr_box) { .x = m->w.x + mx, .y = m->w.y, .width = w, .height = mh }, 0); + mx += c->geom.width; + } else { +- resize(c, (struct wlr_box) { .x = tx, .y = ty, .width = m->w.width - (2 * c->bw), .height = th - (2 * c->bw) }, 0); ++ resize(c, (struct wlr_box) { .x = tx, .y = ty, .width = m->w.width, .height = th }, 0); + if (th != m->w.height) + ty += c->geom.height; + } +-- +2.42.0