[wiki] [sites] [dwm][patch] ru_gaps, fibonacci and bstackhoriz layout fixed with vanitygaps influence || Aaron Duxler

From: <git_AT_suckless.org>
Date: Mon, 20 Apr 2020 21:53:50 +0200

commit ac8c2dbab3fcfef2f55837d3c4df8199d9e588d4
Author: Aaron Duxler <aaron_AT_duxler.xyz>
Date: Mon Apr 20 21:53:46 2020 +0200

    [dwm][patch] ru_gaps, fibonacci and bstackhoriz layout fixed with vanitygaps influence

diff --git a/dwm.suckless.org/patches/ru_gaps/dwm-ru_bottomstack-6.2.diff b/dwm.suckless.org/patches/ru_gaps/dwm-ru_bottomstack-6.2.diff
index bbcb46ac..c722f541 100644
--- a/dwm.suckless.org/patches/ru_gaps/dwm-ru_bottomstack-6.2.diff
+++ b/dwm.suckless.org/patches/ru_gaps/dwm-ru_bottomstack-6.2.diff
_AT_@ -31,7 +31,7 @@ diff -up a/dwm.c b/dwm.c
  static void togglebar(const Arg *arg);
  static void togglefloating(const Arg *arg);
  static void toggletag(const Arg *arg);
-_AT_@ -2176,3 +2178,74 @@ main(int argc, char *argv[])
+_AT_@ -2176,3 +2178,83 @@ main(int argc, char *argv[])
          XCloseDisplay(dpy);
          return EXIT_SUCCESS;
  }
_AT_@ -77,32 +77,41 @@ diff -up a/dwm.c b/dwm.c
 +void
 +bstackhoriz(Monitor *m)
 +{
-+ unsigned int i, n, h, mw, mh, my, ty;
++ unsigned int i, n;
++ int mx = 0, my = 0, mh = 0, mw = 0;
++ int sx = 0, sy = 0, sh = 0, sw = 0;
 + Client *c;
 +
 + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
 + if (n == 0)
 + return;
-+ if(n == 1){
++
++ if (n == 1) {
 + c = nexttiled(m->clients);
 + resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
 + return;
 + }
 +
-+ if (n > m->nmaster)
-+ mh = m->nmaster ? m->wh * m->mfact : m->gappx;
-+ else
-+ mh = m->wh;
-+ mw = m->ww;
++ sx = mx = m->wx + m->gappx;
++ sy = my = m->wy + m->gappx;
++ sh = mh = m->wh - 2*m->gappx;
++ sw = mw = m->ww - 2*m->gappx - m->gappx * (MIN(n, m->nmaster) - 1);
 +
-+ for (i = ty = 0, my = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++ if (m->nmaster && n > m->nmaster) {
++ sh = (mh - m->gappx) * (1 - m->mfact);
++ mh = (mh - m->gappx) * m->mfact;
++ sy = my + mh + m->gappx;
++ sh = m->wh - mh - 2*m->gappx - m->gappx * (n - m->nmaster);
++ sw = m->ww - 2*m->gappx;
++ }
++
++ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
 + if (i < m->nmaster) {
-+ h = (mh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
-+ resize(c, m->wx + m->gappx, m->wy + my, mw - 2*(c->bw + m->gappx), h - (2*c->bw), 0);
-+ my += HEIGHT(c) + m->gappx;
++ resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0);
++ mx += WIDTH(c) + m->gappx;
 + } else {
-+ h = (m->wh - mh - ty) / (n - i) - m->gappx;
-+ resize(c, m->wx + m->gappx, m->wy + mh + ty, mw - 2*(c->bw + m->gappx), h - (2*c->bw), 0);
-+ ty += HEIGHT(c) + m->gappx;
++ resize(c, sx, sy, sw - (2*c->bw), sh / (n - MIN(n, m->nmaster)) - (2*c->bw), 0);
++ sy += HEIGHT(c) + m->gappx;
 + }
++ }
 +}
diff --git a/dwm.suckless.org/patches/ru_gaps/dwm-ru_fibonacci-6.2.diff b/dwm.suckless.org/patches/ru_gaps/dwm-ru_fibonacci-6.2.diff
index 64fd8b99..e88f6331 100644
--- a/dwm.suckless.org/patches/ru_gaps/dwm-ru_fibonacci-6.2.diff
+++ b/dwm.suckless.org/patches/ru_gaps/dwm-ru_fibonacci-6.2.diff
_AT_@ -16,68 +16,69 @@ diff -upN a/config.def.h b/config.def.h
 diff -upN a/fibonacci.c b/fibonacci.c
 --- a/fibonacci.c 1970-01-01 01:00:00.000000000 +0100
 +++ b/fibonacci.c 2019-05-28 21:07:51.119850125 +0200
-_AT_@ -0,0 +1,73 @@
-+void fibonacci(Monitor *mon, int s) {
-+ unsigned int i, n, nx, ny, nw, nh;
+_AT_@ -0,0 +1,74 @@
++static void
++fibonacci(Monitor *m, int s)
++{
++ unsigned int i, n;
++ int nx, ny, nw, nh;
 + Client *c;
 +
-+ for(n = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next), n++);
-+ if(n == 0)
++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
++ if (n == 0)
 + return;
-+ if(n == 1){
-+ c = nexttiled(mon->clients);
-+ resize(c, mon->wx, mon->wy, mon->ww - 2 * c->bw, mon->wh - 2 * c->bw, 0);
++ if (n == 1) {
++ c = nexttiled(m->clients);
++ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
 + return;
 + }
-+
-+ nx = mon->wx;
-+ ny = mon->gappx;
-+ nw = mon->ww;
-+ nh = mon->wh;
-+
-+ for(i = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next)) {
-+ if((i % 2 && nh / 2 > 2 * c->bw)
-+ || (!(i % 2) && nw / 2 > 2 * c->bw)) {
-+ if(i < n - 1) {
-+ if(i % 2)
-+ nh /= 2;
++
++ nx = m->wx + m->gappx;
++ ny = m->gappx;
++ nw = m->ww - 2*m->gappx;
++ nh = m->wh - 2*m->gappx;
++
++ for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
++ if ((i % 2 && nh / 2 > 2*c->bw)
++ || (!(i % 2) && nw / 2 > 2*c->bw)) {
++ if (i < n - 1) {
++ if (i % 2)
++ nh = (nh - m->gappx) / 2;
 + else
-+ nw /= 2;
-+ if((i % 4) == 2 && !s)
-+ nx += nw;
-+ else if((i % 4) == 3 && !s)
-+ ny += nh;
++ nw = (nw - m->gappx) / 2;
++
++ if ((i % 4) == 2 && !s)
++ nx += nw + m->gappx;
++ else if ((i % 4) == 3 && !s)
++ ny += nh + m->gappx;
 + }
-+ if((i % 4) == 0) {
-+ if(s)
-+ ny += nh;
++ if ((i % 4) == 0) {
++ if (s)
++ ny += nh + m->gappx;
 + else
-+ ny -= nh;
++ ny -= nh + m->gappx;
 + }
-+ else if((i % 4) == 1)
-+ nx += nw;
-+ else if((i % 4) == 2)
-+ ny += nh;
-+ else if((i % 4) == 3) {
-+ if(s)
-+ nx += nw;
++ else if ((i % 4) == 1)
++ nx += nw + m->gappx;
++ else if ((i % 4) == 2)
++ ny += nh + m->gappx;
++ else if ((i % 4) == 3) {
++ if (s)
++ nx += nw + m->gappx;
 + else
-+ nx -= nw;
++ nx -= nw + m->gappx;
 + }
-+ if(i == 0)
-+ {
-+ if(n != 1)
-+ nw = mon->ww * mon->mfact;
-+ ny = mon->wy + mon->gappx;
++ if (i == 0) {
++ if (n != 1)
++ nw = (m->ww - 2*m->gappx - m->gappx) * m->mfact;
++ ny = m->wy + m->gappx;
 + }
-+ else if(i == 1)
-+ nw = mon->ww - nw - mon->gappx;
++ else if (i == 1)
++ nw = m->ww - nw - m->gappx - 2*m->gappx;
 + i++;
 + }
-+ if((s == 0 && i <= 4 && (i!=2 || n==2)) || (s==1 && (i%2==1 || i==n)))
-+ resize(c, nx + mon->gappx, ny, nw - 2 * (c->bw) - mon->gappx, nh - 2 * (c->bw) - 2*mon->gappx, False);
-+ else
-+ resize(c, nx + mon->gappx, ny, nw - 2 * (c->bw) - mon->gappx, nh - 2 * (c->bw) - mon->gappx, False);
++
++ resize(c, nx, ny, nw - (2*c->bw), nh - (2*c->bw), False);
 + }
 +}
 +
diff --git a/dwm.suckless.org/patches/ru_gaps/index.md b/dwm.suckless.org/patches/ru_gaps/index.md
index bae0f8c9..f72a5707 100644
--- a/dwm.suckless.org/patches/ru_gaps/index.md
+++ b/dwm.suckless.org/patches/ru_gaps/index.md
_AT_@ -23,15 +23,14 @@ Apply the following patches on top of the previous patch to add
 additional layouts with resizeable gap support.
 
 A copy of the [fibonacci](../fibonacci/), but with resizeable gaps.
- (Window sizes do not scale correctly. Feel free to fix it.)
+This patch is taken from [vanitygaps](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-vanitygaps-6.2.diff)
 * [dwm-ru\_fibonacci-6.2.diff](dwm-ru_fibonacci-6.2.diff)
 
 A copy of the [gaplessgrid](../gaplessgrid/), but with resizeable gaps.
 * [dwm-ru\_gaplessgrid-6.2.diff](dwm-ru_gaplessgrid-6.2.diff) - 25-06-2019
 
 A copy of the [bottomstack](../bottomstack/), but with resizeable gaps.
- (bstack layout works correctly.
- bstackhorizontal layout windows do not scale 100% correctly. Feel free to fix it ;) )
+The bstackhoriz function of this patch is taken from [vanitygaps](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-vanitygaps-6.2.diff)
 * [dwm-ru\_bottomstack-6.2.diff](dwm-ru_bottomstack-6.2.diff) - 24-07-2019
 
 A copy of the [centeredmaster](../centeredmaster/), but with resizeable gaps.
_AT_@ -40,6 +39,12 @@ A copy of the [centeredmaster](../centeredmaster/), but with resizeable gaps.
 A copy of the [deck](../deck/), but with resizeable gaps.
 * [dwm-ru\_deck-6.2.diff](dwm-ru_deck-6.2.diff) - 24-07-2019
 
+Related patches
+---------------
+A different implemetation and more layouts. <br>
+[Github bakkeby dwm-vanitygaps](https://github.com/bakkeby/dwm-vanitygaps/tree/master/patches)<br>
+With this patch some layouts may scale differently with increasing gap pixels.
+
 Authors
 ------
 * Aaron Duxler <aaron_AT_duxler.xyz>
Received on Mon Apr 20 2020 - 21:53:50 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 20 2020 - 22:00:47 CEST