summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-03-02 15:12:21 -0500
committerMatt Hunter <m@lfurio.us>2026-01-18 00:18:46 -0500
commitf22431698fd261219f0e780a74e47de221bae8d4 (patch)
tree45d039f1541aea773946d6b691be46ab85ed7057
parent945ce59ef54857edce8c536754d0325ae7651de3 (diff)
downloaddwm-f22431698fd261219f0e780a74e47de221bae8d4.tar.gz
dwm-f22431698fd261219f0e780a74e47de221bae8d4.zip
patch: philcollins (full columns)
Layout adapted from centerfloatingmaster to simply tile all clients horizontally across the screen, without respect to mfact or nmaster.
-rw-r--r--config.def.h2
-rw-r--r--dwm.c20
2 files changed, 22 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index 6046a25..e27c892 100644
--- a/config.def.h
+++ b/config.def.h
@@ -49,6 +49,7 @@ static const Layout layouts[] = {
{ "||=", col },
{ "=[]", elit },
{ "HHH", grid },
+ { "|||", philcollins },
};
/* key definitions */
@@ -100,6 +101,7 @@ static const Key keys[] = {
{ MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
{ MODKEY, XK_e, setlayout, {.v = &layouts[5]} },
{ MODKEY, XK_g, setlayout, {.v = &layouts[6]} },
+ { MODKEY, XK_c, setlayout, {.v = &layouts[7]} },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
diff --git a/dwm.c b/dwm.c
index 997c3f3..fa12f59 100644
--- a/dwm.c
+++ b/dwm.c
@@ -191,6 +191,7 @@ static void monocle(Monitor *m);
static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
+static void philcollins(Monitor *m);
static void pop(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
@@ -1322,6 +1323,25 @@ nexttiled(Client *c)
}
void
+philcollins(Monitor *m)
+{
+ unsigned int i, n, w, tx;
+ Client *c;
+
+ /* count number of clients in the selected monitor */
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (n == 0)
+ return;
+
+ /* there are no masters, clients are stacked in columns horizontally */
+ for (i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
+ w = (m->ww - tx) / (n - i);
+ resize(c, m->wx + tx, m->wy, w - (2*c->bw), m->wh - (2*c->bw), 0);
+ tx += WIDTH(c);
+ }
+}
+
+void
pop(Client *c)
{
detach(c);