[wiki] [sites] [dwm][deck] Simplify rmaster- and tilegap-versions || aleks

From: <git_AT_suckless.org>
Date: Thu, 23 May 2019 23:53:27 +0200

commit e980a011a6dab94536e0b7840d5b4f22afae6a48
Author: aleks <aleks.stier_AT_icloud.com>
Date: Thu May 23 23:46:16 2019 +0200

    [dwm][deck] Simplify rmaster- and tilegap-versions
    
    The dwm-deck-rmaster/tilegap patches dont't duplicate the dwm-deck
    codde anymore. Instead they have to be applied on top of the dwm-deck
    patch. This makes them simpler and easier to maintain.

diff --git a/dwm.suckless.org/patches/deck/dwm-deck-6.0.diff b/dwm.suckless.org/patches/deck/dwm-deck-6.0.diff
index 84c5cb1e..39ec2ad9 100644
--- a/dwm.suckless.org/patches/deck/dwm-deck-6.0.diff
+++ b/dwm.suckless.org/patches/deck/dwm-deck-6.0.diff
_AT_@ -8,9 +8,14 @@ It applies the monocle-layout to the clients in the stack.
 The master-client is still visible. The stacked clients are like
 a deck of cards, hence the name.
 
-The vanilla patch doesn't respect patches which add gaps (ex. tilegap).
+The vanilla patch doesn't work properly with patches which add gaps.
 This means that when the deck-layout is activated gaps are omitted.
-To make it work with the tilegap-patch use the dwm-deck-tilegap patch.
+To make it work with the tilegap-patch apply the dwm-deck-tilegap patch
+on top of the dwm-deck patch.
+
+The vanilla patch doesn't respect the master-area which is defined by
+the rmaster-patch. To make it work with the rmaster-patch apply the
+dwm-deck-rmaster patch on top of the dwm-deck patch.
 ---
  config.def.h | 2 ++
  dwm.c | 26 ++++++++++++++++++++++++++
diff --git a/dwm.suckless.org/patches/deck/dwm-deck-rmaster-6.1.diff b/dwm.suckless.org/patches/deck/dwm-deck-rmaster-6.1.diff
index 84e6d2dd..5f570096 100644
--- a/dwm.suckless.org/patches/deck/dwm-deck-rmaster-6.1.diff
+++ b/dwm.suckless.org/patches/deck/dwm-deck-rmaster-6.1.diff
_AT_@ -1,93 +1,45 @@
-From c3de13b090e7eb805bae3d6060ada193c58ae5d3 Mon Sep 17 00:00:00 2001
+From ea45fb6fe67e5815e1455559dca4103f6d429f07 Mon Sep 17 00:00:00 2001
 From: aleks <aleks.stier_AT_icloud.com>
-Date: Sat, 18 May 2019 01:06:57 +0200
-Subject: [PATCH] Add deck-rmaster-layout
+Date: Thu, 23 May 2019 23:11:34 +0200
+Subject: [PATCH] Make deck-patch work with the rmaster-patch
 
-deck is a dwm-layout which is inspired by the TTWM window manager.
-It applies the monocle-layout to the clients in the stack.
-The master-client is still visible. The stacked clients are like
-a deck of cards, hence the name.
-
-This patch is ment to be used in combination with the rmaster-patch to
-preserve the side of the master-area which is defined by the
+Apply this patch on top of the deck-patch to make it work with the
 rmaster-patch.
-
-NOTE: This patch doesn't respect patches which add gaps (ex. tilegap).
-This means that when the deck-layout is activated gaps are omitted.
-To make it work with the tilegap-patch use the dwm-deck-tilegap patch.
 ---
- config.def.h | 2 ++
- dwm.c | 30 ++++++++++++++++++++++++++++++
- 2 files changed, 32 insertions(+)
+ dwm.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
 
-diff --git a/config.def.h b/config.def.h
-index b747282..3ae1309 100644
---- a/config.def.h
-+++ b/config.def.h
-_AT_@ -40,6 +40,7 @@ static const Layout layouts[] = {
- { "[]=", tile }, /* first entry is default */
- { "><>", NULL }, /* no layout function means floating behavior */
- { "[M]", monocle },
-+ { "[D]", deck },
- };
-
- /* key definitions */
-_AT_@ -75,6 +76,7 @@ static Key keys[] = {
- { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
- { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
- { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
-+ { MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
- { MODKEY, XK_r, togglermaster, {0} },
- { MODKEY, XK_space, setlayout, {0} },
- { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
 diff --git a/dwm.c b/dwm.c
-index e11bd8b..441a99a 100644
+index 11649dd..441a99a 100644
 --- a/dwm.c
 +++ b/dwm.c
-_AT_@ -159,6 +159,7 @@ static void configure(Client *c);
- static void configurenotify(XEvent *e);
- static void configurerequest(XEvent *e);
- static Monitor *createmon(void);
-+static void deck(Monitor *m);
- static void destroynotify(XEvent *e);
- static void detach(Client *c);
- static void detachstack(Client *c);
-_AT_@ -656,6 +657,35 @@ createmon(void)
- return m;
- }
+_AT_@ -667,7 +667,9 @@ deck(Monitor *m) {
+ return;
  
-+void
-+deck(Monitor *m) {
-+ unsigned int i, n, h, mw, my;
-+ Client *c;
-+
-+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
-+ if(n == 0)
-+ return;
-+
-+ if(n > m->nmaster) {
+ if(n > m->nmaster) {
+- mw = m->nmaster ? m->ww * m->mfact : 0;
 + mw = m->nmaster
 + ? m->ww * (m->rmaster ? 1.0 - m->mfact : m->mfact)
 + : 0;
-+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
-+ }
-+ else
-+ mw = m->ww;
-+ for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
-+ if(i < m->nmaster) {
-+ h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+ }
+ else
+_AT_@ -675,11 +677,13 @@ deck(Monitor *m) {
+ for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if(i < m->nmaster) {
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
 + resize(c, m->rmaster ? m->wx + m->ww - mw : m->wx,
 + m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
-+ my += HEIGHT(c);
-+ }
-+ else
+ my += HEIGHT(c);
+ }
+ else
+- resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
 + resize(c, m->rmaster ? m->wx : m->wx + mw, m->wy,
 + m->ww - mw - (2*c->bw), m->wh - (2*c->bw), 0);
-+}
-+
+ }
+
  void
- destroynotify(XEvent *e)
- {
 --
 2.21.0
 
diff --git a/dwm.suckless.org/patches/deck/dwm-deck-tilegap-6.1.diff b/dwm.suckless.org/patches/deck/dwm-deck-tilegap-6.1.diff
new file mode 100644
index 00000000..30b6e837
--- /dev/null
+++ b/dwm.suckless.org/patches/deck/dwm-deck-tilegap-6.1.diff
_AT_@ -0,0 +1,55 @@
+From a9e442ec18683e2255ffef74404c283bbb0b6381 Mon Sep 17 00:00:00 2001
+From: aleks <aleks.stier_AT_icloud.com>
+Date: Thu, 23 May 2019 23:27:59 +0200
+Subject: [PATCH] Make deck-patch work with the tilegap-patch
+
+Apply this patch on top of the deck-patch to make it work with the
+tilegap-patch.
+---
+ dwm.c | 18 ++++++++++--------
+ 1 file changed, 10 insertions(+), 8 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index 5b68242..1c17891 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -656,7 +656,7 @@ createmon(void)
+
+ void
+ deck(Monitor *m) {
+- unsigned int i, n, h, mw, my;
++ unsigned int i, n, h, mw, my, ns;
+ Client *c;
+
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+_AT_@ -665,18 +665,20 @@ deck(Monitor *m) {
+
+ if(n > m->nmaster) {
+ mw = m->nmaster ? m->ww * m->mfact : 0;
++ ns = m->nmaster > 0 ? 2 : 1;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+- }
+- else
++ } else {
+ mw = m->ww;
+- for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++ ns = 1;
++ }
++ for(i = 0, my = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if(i < m->nmaster) {
+- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
+- my += HEIGHT(c);
++ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
++ resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
++ my += HEIGHT(c) + gappx;
+ }
+ else
+- resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
++ resize(c, m->wx + mw + gappx/ns, m->wy + gappx, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*gappx, False);
+ }
+
+ void
+--
+2.21.0
+
diff --git a/dwm.suckless.org/patches/deck/dwm-deck-tilegap-6.2.diff b/dwm.suckless.org/patches/deck/dwm-deck-tilegap-6.2.diff
deleted file mode 100644
index 06867105..00000000
--- a/dwm.suckless.org/patches/deck/dwm-deck-tilegap-6.2.diff
+++ /dev/null
_AT_@ -1,87 +0,0 @@
-From 0da1bf76c63fa285abcb9241babc4a33ed11cca7 Mon Sep 17 00:00:00 2001
-From: aleks <aleks.stier_AT_icloud.com>
-Date: Mon, 6 May 2019 16:21:02 +0200
-Subject: [PATCH] Add deck-tilegap-layout
-
-deck is a dwm-layout which is inspired by the TTWM window manager.
-It applies the monocle-layout to the clients in the stack.
-The master-client is still visible. The stacked clients are like
-a deck of cards, hence the name.
-
-This patch is ment to be used in combination with the tilegap-patch
-to preserve the gaps when the deck-layout is activated.
----
- config.def.h |  2 ++
- dwm.c        | 29 +++++++++++++++++++++++++++++
- 2 files changed, 31 insertions(+)
-
-diff --git a/config.def.h b/config.def.h
-index 2ca9e56..3606a2e 100644
---- a/config.def.h
-+++ b/config.def.h
-_AT_@ -42,6 +42,7 @@ static const Layout layouts[] = {
- 	{ "[]=",      tile },    /* first entry is default */
- 	{ "><>",      NULL },    /* no layout function means floating behavior */
- 	{ "[M]",      monocle },
-+	{ "[D]",      deck },
- };
- 
- /* key definitions */
-_AT_@ -77,6 +78,7 @@ static Key keys[] = {
- 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
- 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
- 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
-+	{ MODKEY,                       XK_c,      setlayout,      {.v = &layouts[3]} },
- 	{ 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 c556a2d..c5b96dd 100644
---- a/dwm.c
-+++ b/dwm.c
-_AT_@ -157,6 +157,7 @@ static void configure(Client *c);
- static void configurenotify(XEvent *e);
- static void configurerequest(XEvent *e);
- static Monitor *createmon(void);
-+static void deck(Monitor *m);
- static void destroynotify(XEvent *e);
- static void detach(Client *c);
- static void detachstack(Client *c);
-_AT_@ -654,6 +655,34 @@ destroynotify(XEvent *e)
- 		unmanage(c, 1);
- }
- 
-+void
-+deck(Monitor *m)
-+{
-+	unsigned int i, n, h, mw, my, ns;
-+	Client *c;
-+
-+	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
-+	if(n == 0)
-+		return;
-+
-+	if(n > m->nmaster) {
-+		mw = m->nmaster ? m->ww * m->mfact : 0;
-+		ns = m->nmaster > 0 ? 2 : 1;
-+		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
-+	} else {
-+		mw = m->ww;
-+		ns = 1;
-+	}
-+	for(i = 0, my = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
-+		if(i < m->nmaster) {
-+			h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
-+			resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
-+			my += HEIGHT(c) + gappx;
-+		}
-+		else
-+			resize(c, m->wx + mw + gappx/ns, m->wy + gappx, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*gappx, False);
-+}
-+
- void
- detach(Client *c)
- {
--- 
-2.21.0
-
diff --git a/dwm.suckless.org/patches/deck/index.md b/dwm.suckless.org/patches/deck/index.md
index a259fba9..a4692cf7 100644
--- a/dwm.suckless.org/patches/deck/index.md
+++ b/dwm.suckless.org/patches/deck/index.md
_AT_@ -11,14 +11,15 @@ a deck of cards, hence the name.
 deck-rmaster
 ------------
 The vanilla patch doesn't respect the master-area which is defined by
-the rmaster-patch. To make it work with the rmaster-patch use the
-dwm-deck-rmaster version.
+the rmaster-patch. To make it work with the rmaster-patch apply the
+dwm-deck-rmaster patch on top of the dwm-deck patch.
 
 deck-tilegap
 ------------
-The vanilla patch doesn't respect patches which add gaps (ex. tilegap).
+The vanilla patch doesn't work properly with patches which add gaps.
 This means that when the deck-layout is activated gaps are omitted.
-To make it work with the tilegap-patch use the dwm-deck-tilegap version.
+To make it work with the tilegap-patch apply the dwm-deck-tilegap patch
+on top of the dwm-deck patch.
 
 Showcase
 --------
_AT_@ -49,12 +50,7 @@ Download
 --------
 * [dwm-deck-6.0.diff](dwm-deck-6.0.diff)
 * [dwm-deck-rmaster-6.1.diff](dwm-deck-rmaster-6.1.diff)
-* [dwm-deck-tilegap-6.2.diff](dwm-deck-tilegap-6.2.diff)
-
-TODO
-----
-Make deck-rmaster and -tilegap simpler by pulling out the deck-logic.
-They should be used on top of the vanilla deck-patch and not separately.
+* [dwm-deck-tilegap-6.1.diff](dwm-deck-tilegap-6.2.diff)
 
 Author
 ------
Received on Thu May 23 2019 - 23:53:27 CEST

This archive was generated by hypermail 2.3.0 : Fri May 24 2019 - 00:00:45 CEST