sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 158066bfc7322ab3199dd69de4773ab2cac8d325
parent b247b6e1beb9c87969754c0865561de39bfcbe09
Author: Lee Phillips <lee@lee-phillips.org>
Date:   Mon,  8 Dec 2025 11:48:32 -0600

Fix commit 68ece7f

Including patch file and fixing links in README.
Sorry

Diffstat:
Adwm.suckless.org/patches/bstackmfact/dwm-bstackmfact-6.6.diff | 221+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/bstackmfact/index.md | 21+++++++++++++++++++++
2 files changed, 242 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/bstackmfact/dwm-bstackmfact-6.6.diff b/dwm.suckless.org/patches/bstackmfact/dwm-bstackmfact-6.6.diff @@ -0,0 +1,221 @@ +diff --git a/config.def.h b/config.def.h +index 9efa774..c0bfede 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -3,6 +3,7 @@ + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ + static const unsigned int snap = 32; /* snap pixel */ ++static const unsigned int minwsz = 20; /* Minimal heigt of a client for smfact */ + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ + static const char *fonts[] = { "monospace:size=10" }; +@@ -33,6 +34,7 @@ static const Rule rules[] = { + + /* layout(s) */ + static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ ++static const float smfact = 0.00; /* factor of tiled clients [0.00..0.95] */ + static const int nmaster = 1; /* number of clients in master area */ + static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ +@@ -42,6 +44,8 @@ static const Layout layouts[] = { + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, ++ { "TTT", bstack }, ++ { "===", bstackhoriz }, + }; + + /* key definitions */ +@@ -71,12 +75,16 @@ static const Key keys[] = { + { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, ++ { MODKEY|ShiftMask, XK_h, setsmfact, {.f = +0.05} }, ++ { MODKEY|ShiftMask, XK_l, setsmfact, {.f = -0.05} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, ++ { MODKEY, XK_s, setlayout, {.v = &layouts[3]} }, ++ { MODKEY, XK_z, setlayout, {.v = &layouts[4]} }, + { 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 1443802..1f829b8 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -70,6 +70,7 @@ typedef union { + int i; + unsigned int ui; + float f; ++ float sf; + const void *v; + } Arg; + +@@ -113,6 +114,7 @@ typedef struct { + struct Monitor { + char ltsymbol[16]; + float mfact; ++ float smfact; + int nmaster; + int num; + int by; /* bar geometry */ +@@ -201,6 +203,7 @@ static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); + static void setlayout(const Arg *arg); + static void setmfact(const Arg *arg); ++static void setsmfact(const Arg *arg); + static void setup(void); + static void seturgent(Client *c, int urg); + static void showhide(Client *c); +@@ -232,6 +235,8 @@ static int xerror(Display *dpy, XErrorEvent *ee); + static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); ++static void bstack(Monitor *m); ++static void bstackhoriz(Monitor *m); + + /* variables */ + static const char broken[] = "broken"; +@@ -633,10 +638,10 @@ Monitor * + createmon(void) + { + Monitor *m; +- + m = ecalloc(1, sizeof(Monitor)); + m->tagset[0] = m->tagset[1] = 1; + m->mfact = mfact; ++ m->smfact = smfact; + m->nmaster = nmaster; + m->showbar = showbar; + m->topbar = topbar; +@@ -1535,6 +1540,20 @@ setmfact(const Arg *arg) + arrange(selmon); + } + ++ void ++setsmfact(const Arg *arg) { ++ float sf; ++ ++ if(!arg || !selmon->lt[selmon->sellt]->arrange) ++ return; ++ sf = arg->sf < 1.0 ? arg->sf + selmon->smfact : arg->sf - 1.0; ++ if(sf < 0 || sf > 0.9) ++ return; ++ selmon->smfact = sf; ++ arrange(selmon); ++} ++ ++ + void + setup(void) + { +@@ -1686,7 +1705,7 @@ tagmon(const Arg *arg) + void + tile(Monitor *m) + { +- unsigned int i, n, h, mw, my, ty; ++ unsigned int i, n, h, smh, mw, my, ty; + Client *c; + + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); +@@ -1704,9 +1723,22 @@ tile(Monitor *m) + if (my + HEIGHT(c) < m->wh) + my += HEIGHT(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) ++ smh = m->mh * m->smfact; ++ if(!(nexttiled(c->next))) ++ h = (m->wh - ty) / (n - i); ++ else ++ h = (m->wh - smh - ty) / (n - i); ++ if(h < minwsz) { ++ c->isfloating = True; ++ XRaiseWindow(dpy, c->win); ++ resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), False); ++ ty -= HEIGHT(c); ++ } ++ else ++ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False); ++ if(!(nexttiled(c->next))) ++ ty += HEIGHT(c) + smh; ++ else + ty += HEIGHT(c); + } + } +@@ -2162,3 +2194,69 @@ main(int argc, char *argv[]) + XCloseDisplay(dpy); + return EXIT_SUCCESS; + } ++ ++static void ++bstack(Monitor *m) { ++ int w, h, mh, mx, tx, ty, tw, tws; ++ unsigned int i, n; ++ Client *c; ++ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ if (n > m->nmaster) { ++ mh = m->nmaster ? m->mfact * m->wh : 0; ++ tw = m->ww / (n - m->nmaster); ++ ty = m->wy + mh; ++ } else { ++ mh = m->wh; ++ tw = m->ww; ++ ty = m->wy; ++ } ++ for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { ++ if (i < m->nmaster) { ++ w = (m->ww - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); ++ mx += WIDTH(c); ++ } else { ++ h = m->wh - mh; ++ if (i == m->nmaster) { ++ tws = (n > 2) ? tw + m->mw * m->smfact / 2: tw;} ++ else { ++ tws = tw - m->mw * m->smfact/MAX(n-2, 1) / 2;} ++ resize(c, tx, ty, tws - (2 * c->bw), h - (2 * c->bw), 0); ++ if (tw != m->ww) ++ tx += WIDTH(c); ++ } ++ } ++} ++ ++static void ++bstackhoriz(Monitor *m) { ++ int w, mh, mx, tx, ty, th; ++ unsigned int i, n; ++ Client *c; ++ ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ if (n == 0) ++ return; ++ if (n > m->nmaster) { ++ mh = m->nmaster ? m->mfact * m->wh : 0; ++ th = (m->wh - mh) / (n - m->nmaster); ++ ty = m->wy + mh; ++ } else { ++ th = mh = m->wh; ++ ty = m->wy; ++ } ++ for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { ++ if (i < m->nmaster) { ++ w = (m->ww - mx) / (MIN(n, m->nmaster) - i); ++ resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); ++ mx += WIDTH(c); ++ } else { ++ resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0); ++ if (th != m->wh) ++ ty += HEIGHT(c); ++ } ++ } ++} diff --git a/dwm.suckless.org/patches/bstackmfact/index.md b/dwm.suckless.org/patches/bstackmfact/index.md @@ -0,0 +1,21 @@ +bmstackmfact +============ + +Description +----------- +Updates and combines the [bottomstack patch](../bottomstack/) and the +[stackmfact patch](../stackmfact). Invoking the `setsmfact` function +(default binding shift-mod-[h,l]) with the bottomstack +layout changes the width of the first client in the +stack and distrubutes the remaining screen width equally among the +remaining clients. The effect of `setmfact` on the tiling layout +remains as in the original stackmfact patch. + +Download +-------- +[dwm-bstackmfact-6.6.diff](dwm-bstackmfact-6.6.diff) + +Author +------ +[Lee Phillips](https://lee-phillips.org/) - <lee at lee-phillips.org> +