diff options
author | Malfurious <m@lfurio.us> | 2024-03-02 15:12:21 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-03-05 21:04:47 -0500 |
commit | dde75954fa94186d192b9a8c78dba7bbd040eb47 (patch) | |
tree | 93d68876b1f1d0a08af24c4ea5d18cc8851e3e43 | |
parent | 74eb25562964b4d42979b82805f01427147f717a (diff) | |
download | dwm-dde75954fa94186d192b9a8c78dba7bbd040eb47.tar.gz dwm-dde75954fa94186d192b9a8c78dba7bbd040eb47.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.h | 2 | ||||
-rw-r--r-- | dwm.c | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h index 2b319cf..03296f0 100644 --- a/config.def.h +++ b/config.def.h @@ -53,6 +53,7 @@ static const Layout layouts[] = { { "||=", col }, { "=[]", elit }, { "HHH", grid }, + { "|||", philcollins }, }; /* key definitions */ @@ -104,6 +105,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 } }, @@ -192,6 +192,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); @@ -1323,6 +1324,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); |