[wiki] [sites] [dwm][deck] Add deck-tilegap patch || aleks

From: <git_AT_suckless.org>
Date: Mon, 06 May 2019 16:58:26 +0200

commit 723cbba1701b783911cafa143eb6696188cace23
Author: aleks <aleks.stier_AT_icloud.com>
Date: Mon May 6 16:47:36 2019 +0200

    [dwm][deck] Add deck-tilegap patch
    
    Add dwm-deck-tilegap-6.2 patch which is meant to be used in combination
    with the tilegap-patch. This makes sure that gaps are preserved when the
    deck-layout is activated.

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 c6b7b9a1..84c5cb1e 100644
--- a/dwm.suckless.org/patches/deck/dwm-deck-6.0.diff
+++ b/dwm.suckless.org/patches/deck/dwm-deck-6.0.diff
_AT_@ -1,12 +1,16 @@
-From b9bbda20e4ef34f603485e43d1f3664020845122 Mon Sep 17 00:00:00 2001
+From cb3cac91db32403bb581aecbc2957b00bb49c898 Mon Sep 17 00:00:00 2001
 From: aleks <aleks.stier_AT_icloud.com>
-Date: Mon, 6 May 2019 14:49:20 +0200
+Date: Mon, 6 May 2019 16:34:58 +0200
 Subject: [PATCH] Add deck-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.
+
+The vanilla 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 | 26 ++++++++++++++++++++++++++
_AT_@ -33,17 +37,17 @@ index 77ff358..55d8a07 100644
          { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
          { MODKEY, XK_0, view, {.ui = ~0 } },
 diff --git a/dwm.c b/dwm.c
-index 1d78655..d699a7f 100644
+index 1d78655..356ab44 100644
 --- a/dwm.c
 +++ b/dwm.c
-_AT_@ -172,6 +172,7 @@ static void configurenotify(XEvent *e);
+_AT_@ -171,6 +171,7 @@ static void configure(Client *c);
+ static void configurenotify(XEvent *e);
  static void configurerequest(XEvent *e);
  static Monitor *createmon(void);
- static void destroynotify(XEvent *e);
 +static void deck(Monitor *m);
+ static void destroynotify(XEvent *e);
  static void detach(Client *c);
  static void detachstack(Client *c);
- static void die(const char *errstr, ...);
 _AT_@ -669,6 +670,31 @@ destroynotify(XEvent *e) {
                  unmanage(c, True);
  }
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
new file mode 100644
index 00000000..06867105
--- /dev/null
+++ b/dwm.suckless.org/patches/deck/dwm-deck-tilegap-6.2.diff
_AT_@ -0,0 +1,87 @@
+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 62d97236..fd321bf6 100644
--- a/dwm.suckless.org/patches/deck/index.md
+++ b/dwm.suckless.org/patches/deck/index.md
_AT_@ -8,8 +8,9 @@ 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.
 
-NOTE: Doesn't respect patches which add gaps (ex. tilegap).
+The vanilla 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.
 
         Tile :
         +-----------------+--------+
_AT_@ -36,6 +37,7 @@ This means that when the deck-layout is activated gaps are omitted.
 Download
 --------
 * [dwm-deck-6.0.diff](dwm-deck-6.0.diff)
+* [dwm-deck-tilegap-6.2.diff](dwm-deck-tilegap-6.2.diff)
 
 Author
 ------
Received on Mon May 06 2019 - 16:58:26 CEST

This archive was generated by hypermail 2.3.0 : Mon May 06 2019 - 17:00:28 CEST