[wiki] [sites] [dwm][PATCH] added xtile runtime gaps for version 6.2 [new] || MLquest8

From: <git_AT_suckless.org>
Date: Mon, 15 Jun 2020 20:15:31 +0200

commit a1ed8141e25c1ef6fdd112f4f4828c9062f6986d
Author: MLquest8 <miskuzius_AT_gmail.com>
Date: Mon Jun 15 22:12:45 2020 +0400

    [dwm][PATCH] added xtile runtime gaps for version 6.2 [new]

diff --git a/dwm.suckless.org/patches/xresources/index.md b/dwm.suckless.org/patches/xresources/index.md
index e44e0710..dd6b02de 100644
--- a/dwm.suckless.org/patches/xresources/index.md
+++ b/dwm.suckless.org/patches/xresources/index.md
_AT_@ -26,7 +26,7 @@ This patch is a port of the st patch of the same name, it also borrows some code
 
 Download
 --------
-* [dwm-xresources-6.2.diff](dwm-xresources-6.2.diff) 11/06/2020
+* [dwm-xresources-6.2.diff](dwm-xresources-6.2.diff) (11/06/2020)
 
 Author
 ------
diff --git a/dwm.suckless.org/patches/xtile/dwm-xtile-gaps-6.2.diff b/dwm.suckless.org/patches/xtile/dwm-xtile-gaps-6.2.diff
new file mode 100644
index 00000000..f12af826
--- /dev/null
+++ b/dwm.suckless.org/patches/xtile/dwm-xtile-gaps-6.2.diff
_AT_@ -0,0 +1,153 @@
+From 09e6db7a154c2dc3f6c5533ba3e33f460a8e21e1 Mon Sep 17 00:00:00 2001
+From: MLquest8 <miskuzius_AT_gmail.com>
+Date: Mon, 15 Jun 2020 21:32:22 +0400
+Subject: [PATCH] gaps for xtile. Fully independent outer and inner gaps
+ adjustable at runtime. Also includes a setting to disable gaps when only one
+ window is open. For version 6.2
+
+---
+ config.def.h | 9 +++++++++
+ dwm.c | 55 ++++++++++++++++++++++++++++++++++++++++------------
+ 2 files changed, 52 insertions(+), 12 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 254e51c..91871de 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -2,6 +2,9 @@
+
+ /* appearance */
+ static const unsigned int borderpx = 1; /* border pixel of windows */
++static const unsigned int igappx = 5; /* size of inner gaps */
++static const unsigned int ogappx = 5; /* size of outer gaps */
++static const int gapsforone = 0; /* 1 enable gaps when only one window is open */
+ static const unsigned int snap = 32; /* snap pixel */
+ static const int showbar = 1; /* 0 means no bar */
+ static const int topbar = 1; /* 0 means bottom bar */
+_AT_@ -76,6 +79,12 @@ static Key keys[] = {
+ { MODKEY, XK_Return, zoom, {0} },
+ { MODKEY, XK_Tab, view, {0} },
+ { MODKEY|ShiftMask, XK_c, killclient, {0} },
++ { MODKEY|ShiftMask, XK_i, setigaps, {.i = +2 } },
++ { MODKEY|ControlMask, XK_i, setigaps, {.i = -2 } },
++ { MODKEY|ShiftMask|ControlMask, XK_i, setigaps, {.i = 0 } },
++ { MODKEY|ShiftMask, XK_o, setogaps, {.i = +2 } },
++ { MODKEY|ControlMask, XK_o, setogaps, {.i = -2 } },
++ { MODKEY|ShiftMask|ControlMask, XK_o, setogaps, {.i = 0 } },
+ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
+ { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+diff --git a/dwm.c b/dwm.c
+index e43fbad..570739e 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -130,6 +130,7 @@ struct Monitor {
+ int by; /* bar geometry */
+ int mx, my, mw, mh; /* screen size */
+ int wx, wy, ww, wh; /* window area */
++ int igappx, ogappx; /* inner and outer gaps */
+ unsigned int seltags;
+ unsigned int sellt;
+ unsigned int tagset[2];
+_AT_@ -214,6 +215,8 @@ static void setdirs(const Arg *arg);
+ static void setfacts(const Arg *arg);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
++static void setigaps(const Arg *arg);
++static void setogaps(const Arg *arg);
+ static void setlayout(const Arg *arg);
+ static void setup(void);
+ static void seturgent(Client *c, int urg);
+_AT_@ -666,6 +669,8 @@ createmon(void)
+ m->nmaster = nmaster;
+ m->showbar = showbar;
+ m->topbar = topbar;
++ m->igappx = igappx;
++ m->ogappx = ogappx;
+ m->lt[0] = &layouts[0];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+ strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
+_AT_@ -1569,6 +1574,26 @@ setfullscreen(Client *c, int fullscreen)
+ }
+ }
+
++void
++setigaps(const Arg *arg)
++{
++ if ((arg->i == 0) || (selmon->igappx + arg->i < 0))
++ selmon->igappx = 0;
++ else
++ selmon->igappx += arg->i;
++ arrange(selmon);
++}
++
++void
++setogaps(const Arg *arg)
++{
++ if ((arg->i == 0) || (selmon->ogappx + arg->i < 0))
++ selmon->ogappx = 0;
++ else
++ selmon->ogappx += arg->i;
++ arrange(selmon);
++}
++
+ void
+ setlayout(const Arg *arg)
+ {
+_AT_@ -1733,7 +1758,7 @@ tile(Monitor *m)
+ Client *c;
+
+ Area *ga = m->pertag->areas[m->pertag->curtag], *ma = ga + 1, *sa = ga + 2, *a;
+- unsigned int n, i, w, h, ms, ss;
++ unsigned int n, i, w, h, g, ms, ss;
+ float f;
+
+ /* print layout symbols */
+_AT_@ -1746,27 +1771,33 @@ tile(Monitor *m)
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (n == 0)
+ return;
++ if(n == 1 && gapsforone == 0){
++ c = nexttiled(m->clients);
++ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
++ return;
++ }
+
+ ma->n = MIN(n, m->nmaster), sa->n = n - ma->n;
+ /* calculate area rectangles */
+ f = ma->n == 0 ? 0 : (sa->n == 0 ? 1 : ga->fact / 2);
++ g = ma->n == 0 || sa->n == 0 ? 0 : m->igappx;
+ if(ga->dir == DirHor || ga->dir == DirRotHor)
+- ms = f * m->ww, ss = m->ww - ms,
+- ma->x = ga->dir == DirHor ? 0 : ss, ma->y = 0, ma->fx = ma->x + ms, ma->fy = m->wh,
+- sa->x = ga->dir == DirHor ? ms : 0, sa->y = 0, sa->fx = sa->x + ss, sa->fy = m->wh;
++ ms = f * (m->ww - g), ss = m->ww - ms - g,
++ ma->x = ga->dir == DirHor ? 0 + m->ogappx : ss + g + m->ogappx, ma->y = 0 + m->ogappx, ma->fx = ma->x + ms - 2*m->ogappx, ma->fy = m->wh - m->ogappx,
++ sa->x = ga->dir == DirHor ? ms + g - m->ogappx : 0 + m->ogappx, sa->y = 0 + m->ogappx, sa->fx = sa->x + ss, sa->fy = m->wh - m->ogappx;
+ else
+- ms = f * m->wh, ss = m->wh - ms,
+- ma->x = 0, ma->y = ga->dir == DirVer ? 0 : ss, ma->fx = m->ww, ma->fy = ma->y + ms,
+- sa->x = 0, sa->y = ga->dir == DirVer ? ms : 0, sa->fx = m->ww, sa->fy = sa->y + ss;
++ ms = f * (m->wh - g), ss = m->wh - ms - g,
++ ma->x = 0 + m->ogappx, ma->y = ga->dir == DirVer ? 0 + m->ogappx : ss + g + m->ogappx, ma->fx = m->ww - m->ogappx, ma->fy = ma->y + ms - 2*m->ogappx,
++ sa->x = 0 + m->ogappx, sa->y = ga->dir == DirVer ? ms + g - m->ogappx : 0 + m->ogappx, sa->fx = m->ww - m->ogappx, sa->fy = sa->y + ss;
+ /* tile clients */
+ for(c = nexttiled(m->clients), i = 0; i < n; c = nexttiled(c->next), i++) {
+ a = ma->n > 0 ? ma : sa;
+ f = i == 0 || ma->n == 0 ? a->fact : 1, f /= --a->n + f;
+- w = (a->dir == DirVer ? 1 : f) * (a->fx - a->x);
+- h = (a->dir == DirHor ? 1 : f) * (a->fy - a->y);
+- resize(c, m->wx + a->x, m->wy + a->y, w - 2 * c->bw, h - 2 * c->bw, False);
+- a->x += a->dir == DirHor ? w : 0;
+- a->y += a->dir == DirVer ? h : 0;
++ w = a->dir == DirVer ? a->fx - a->x : f * (a->fx - a->x - a->n * m->igappx);
++ h = a->dir == DirHor ? a->fy - a->y : f * (a->fy - a->y - a->n * m->igappx);;
++ resize(c, m->wx + a->x, m->wy + a->y, w - 2 * c->bw, h - 2 * c->bw, 0);
++ a->x += a->dir == DirHor ? w + m->igappx : 0;
++ a->y += a->dir == DirVer ? h + m->igappx : 0;
+ }
+ }
+
+--
+2.26.2
+
diff --git a/dwm.suckless.org/patches/xtile/index.md b/dwm.suckless.org/patches/xtile/index.md
index adf3e9fa..bbf3c5fe 100644
--- a/dwm.suckless.org/patches/xtile/index.md
+++ b/dwm.suckless.org/patches/xtile/index.md
_AT_@ -149,30 +149,46 @@ Fortunately, dwm provides a much better mechanism to restrict visibility: tags.
 IMO there is no need to provide a half-assed alternative to one of dwm's
 strongest selling points.
 
-Other patches
--------------
-Recommended complementary patches:
+Mandatory dependencies:
+* [pertag](../pertag/): we all know this one.
 
-* [gaps](../gaps/): to add mostly useless gaps that nevertheless make more
- apparent which client has the focus.
+Download
+--------
+* [dwm-xtile-6.2.diff](dwm-xtile-6.2.diff) (11/06/2020)
+* [dwm-6.0-xtile.diff](dwm-6.0-xtile.diff)
 
-* [stacker](../stacker/): to better accommodate the clients to the more
- elaborate layouts allowed by xtile. But I would add: subject to the caveats
- that I've expressed above.
+Recommended complementary patches\:
+----------------------------------
+Gaps
+----
+Added a new patch with separate inner and outer gaps which can be adjusted
+at runtime. Also includes an option to disable gaps when only one window
+is open (on by default.)
 
-Mandatory dependencies:
+`Mod+Shift+i/o - increase size (i - inner, o - outer)`
+`Mod+Control+i/o - decrease size (i - inner, o - outer)`
+`Mod+Shift+Control+i/o - disable gaps (i - inner, o - outer)`
 
-* [pertag](../pertag/): we all know this one.
+Download
+--------
+* [dwm-xtile-gaps-6.2.diff](dwm-xtile-gaps-6.2.diff) (15/06/2020)
+* Visit [gaps](../gaps/) page for older versions.
 
-Related patches: [bottom stack](../bottomstack/), [flextile](../flextile/),
-cfacts, [stackmfact](../stackmfact/).
+Stacker
+-------
+A patch to better accommodate the clients to the more elaborate layouts allowed
+by xtile. But I would add: subject to the caveats that I've expressed above.
 
 Download
 --------
-* [dwm-xtile-6.2.diff](dwm-xtile-6.2.diff) 11/06/2020
-* [dwm-6.0-xtile.diff](dwm-6.0-xtile.diff)
+* Visit [stacker](../stacker/) page to download. (6.2 version available)
+
+Patches related to xtile:
+[bottom stack](../bottomstack/), [flextile](../flextile/),
+[cfacts](../cfacts/), [stackmfact](../stackmfact/).
+
 
-Author
+Authors
 ------
-* MLquest8 (updated for 6.2) (miskuzius at gmail.com)
+* MLquest8 (gaps and update for 6.2) (miskuzius at gmail.com)
 * Carlos Pita (memeplex) <carlosjosepita_AT_gmail.com>
Received on Mon Jun 15 2020 - 20:15:31 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 15 2020 - 20:24:43 CEST