dwm-cfacts_deck-6.2.diff (2383B)
1 diff -up a/config.def.h b/config.def.h 2 --- a/config.def.h 2020-04-17 13:37:50.926942626 +0200 3 +++ b/config.def.h 2020-04-25 15:55:19.651489583 +0200 4 @@ -41,6 +41,7 @@ static const Layout layouts[] = { 5 { "[]=", tile }, /* first entry is default */ 6 { "><>", NULL }, /* no layout function means floating behavior */ 7 { "[M]", monocle }, 8 + { "[D]", deck }, 9 }; 10 11 /* key definitions */ 12 @@ -76,6 +77,7 @@ static Key keys[] = { 13 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 14 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 15 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 16 + { MODKEY, XK_c, setlayout, {.v = &layouts[3]} }, 17 { MODKEY, XK_space, setlayout, {0} }, 18 { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 19 { MODKEY, XK_0, view, {.ui = ~0 } }, 20 Only in b: config.def.h.orig 21 Only in b: config.def.h.rej 22 diff -up a/dwm.c b/dwm.c 23 --- a/dwm.c 2020-04-17 13:37:50.926942626 +0200 24 +++ b/dwm.c 2020-04-25 15:58:19.435210980 +0200 25 @@ -157,6 +157,7 @@ static void configure(Client *c); 26 static void configurenotify(XEvent *e); 27 static void configurerequest(XEvent *e); 28 static Monitor *createmon(void); 29 +static void deck(Monitor *m); 30 static void destroynotify(XEvent *e); 31 static void detach(Client *c); 32 static void detachstack(Client *c); 33 @@ -655,6 +656,37 @@ destroynotify(XEvent *e) 34 } 35 36 void 37 +deck(Monitor *m) { 38 + unsigned int i, n, h, mw, my; 39 + float mfacts = 0; 40 + Client *c; 41 + 42 + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) { 43 + if (n < m->nmaster) 44 + mfacts += c->cfact; 45 + } 46 + if(n == 0) 47 + return; 48 + 49 + if(n > m->nmaster) { 50 + mw = m->nmaster ? m->ww * m->mfact : 0; 51 + snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster); 52 + } 53 + else 54 + mw = m->ww; 55 + for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) 56 + if(i < m->nmaster) { 57 + h = (m->wh - my) * (c->cfact / mfacts); 58 + resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False); 59 + if (my + HEIGHT(c) < m->wh) 60 + my += HEIGHT(c); 61 + mfacts -= c->cfact; 62 + } 63 + else 64 + resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False); 65 +} 66 + 67 +void 68 detach(Client *c) 69 { 70 Client **tc;