[wiki] [sites] Added the fullgaps patch for dwm || Maciej Sumalvico

From: <git_AT_suckless.org>
Date: Mon, 18 Feb 2019 22:29:04 +0100

commit ee7c8171fac843c874058c3e146d632bec369c2a
Author: Maciej Sumalvico <macjan_AT_o2.pl>
Date: Mon Feb 18 22:27:50 2019 +0100

    Added the fullgaps patch for dwm

diff --git a/dwm.suckless.org/patches/fullgaps/dwm-fullgaps-6.2.diff b/dwm.suckless.org/patches/fullgaps/dwm-fullgaps-6.2.diff
new file mode 100644
index 00000000..7206aec8
--- /dev/null
+++ b/dwm.suckless.org/patches/fullgaps/dwm-fullgaps-6.2.diff
_AT_@ -0,0 +1,95 @@
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..38d2f6c 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -2,6 +2,7 @@
+
+ /* appearance */
+ static const unsigned int borderpx = 1; /* border pixel of windows */
++static const unsigned int gappx = 5; /* gaps between windows */
+ 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_@ -84,6 +85,9 @@ static Key keys[] = {
+ { MODKEY, XK_period, focusmon, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
++ { MODKEY, XK_minus, setgaps, {.i = -1 } },
++ { MODKEY, XK_equal, setgaps, {.i = +1 } },
++ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+ TAGKEYS( XK_3, 2)
+diff --git a/dwm.c b/dwm.c
+index 4465af1..4363627 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -119,6 +119,7 @@ struct Monitor {
+ int by; /* bar geometry */
+ int mx, my, mw, mh; /* screen size */
+ int wx, wy, ww, wh; /* window area */
++ int gappx; /* gaps between windows */
+ unsigned int seltags;
+ unsigned int sellt;
+ unsigned int tagset[2];
+_AT_@ -199,6 +200,7 @@ static void sendmon(Client *c, Monitor *m);
+ static void setclientstate(Client *c, long state);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
++static void setgaps(const Arg *arg);
+ static void setlayout(const Arg *arg);
+ static void setmfact(const Arg *arg);
+ static void setup(void);
+_AT_@ -638,6 +640,7 @@ createmon(void)
+ m->nmaster = nmaster;
+ m->showbar = showbar;
+ m->topbar = topbar;
++ m->gappx = gappx;
+ m->lt[0] = &layouts[0];
+ m->lt[1] = &layouts[1 % LENGTH(layouts)];
+ strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
+_AT_@ -1497,6 +1500,16 @@ setfullscreen(Client *c, int fullscreen)
+ }
+ }
+
++void
++setgaps(const Arg *arg)
++{
++ if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
++ selmon->gappx = 0;
++ else
++ selmon->gappx += arg->i;
++ arrange(selmon);
++}
++
+ void
+ setlayout(const Arg *arg)
+ {
+_AT_@ -1683,16 +1696,16 @@ tile(Monitor *m)
+ if (n > m->nmaster)
+ mw = m->nmaster ? m->ww * m->mfact : 0;
+ else
+- mw = m->ww;
+- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++ mw = m->ww - m->gappx;
++ for (i = 0, my = ty = m->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), 0);
+- my += HEIGHT(c);
++ h = (m->wh - 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;
+ } else {
+- h = (m->wh - ty) / (n - i);
+- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
+- ty += HEIGHT(c);
++ h = (m->wh - ty) / (n - i) - m->gappx;
++ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
++ ty += HEIGHT(c) + m->gappx;
+ }
+ }
+
+--
+2.20.1
+
diff --git a/dwm.suckless.org/patches/fullgaps/index.md b/dwm.suckless.org/patches/fullgaps/index.md
new file mode 100644
index 00000000..2ed15bcb
--- /dev/null
+++ b/dwm.suckless.org/patches/fullgaps/index.md
_AT_@ -0,0 +1,21 @@
+fullgaps
+========
+
+Description
+-----------
+This patch adds gaps between client windows. It is similar to [gaps](../gaps/),
+but contains additional functionality:
+* it also adds outer gaps (between the clients and the screen frame), as well
+ as a gap between the master and stack area,
+* it adds keybindings to change the gap size at runtime: [Alt]+[-]/[Alt]+[=] to
+ decrease/increase the gap size and [Alt]+[Shift]+[=] to set it to zero.
+
+The configuration variable `gappx` contains the default gap size.
+
+Download
+--------
+* [dwm-fullgaps-6.2.diff](dwm-fullgaps-6.2.diff)
+
+Author
+------
+* Maciej Sumalvico <macjan_AT_o2.pl>
Received on Mon Feb 18 2019 - 22:29:04 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 18 2019 - 22:36:27 CET