summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2022-10-07 05:03:10 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2022-10-07 05:03:10 +0530
commit88d4c573c63a7d9928549ca37d6774945c52b757 (patch)
treeab62e43461ab2d33b335b3a947f9ef1e1d434cd0
parent981ca1209f72d841dbd71df62faaca3b9fd8d1d0 (diff)
fixing fullgaps patch to avoid manual patching in future
-rw-r--r--patches/04.dwm-fullgaps-6.2-fx.diff196
-rw-r--r--patches/04.dwm-fullgaps-6.2.diff97
2 files changed, 196 insertions, 97 deletions
diff --git a/patches/04.dwm-fullgaps-6.2-fx.diff b/patches/04.dwm-fullgaps-6.2-fx.diff
new file mode 100644
index 0000000..7670c54
--- /dev/null
+++ b/patches/04.dwm-fullgaps-6.2-fx.diff
@@ -0,0 +1,196 @@
+diff --git a/config.h b/config.h
+index 397fd61..fbf2729 100644
+--- a/config.h
++++ b/config.h
+@@ -2,6 +2,7 @@
+
+ /* appearance */
+ static const unsigned int borderpx = 1; /* border pixel of windows */
++static const unsigned int gappx = 15; /* gaps between windows */
+ static const unsigned int snap = 32; /* snap pixel */
+ static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
+ static const int showbar = 1; /* 0 means no bar */
+@@ -88,6 +89,9 @@ static const 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 } },
+ { MODKEY, XK_F5, xrdb, {.v = NULL } },
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+diff --git a/dwm.c b/dwm.c
+index 3f9e07d..7408202 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -143,6 +143,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];
+@@ -227,6 +228,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);
+@@ -730,6 +732,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);
+@@ -1634,6 +1637,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)
+ {
+@@ -1832,18 +1845,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);
+- if (my + HEIGHT(c) < m->wh)
+- 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);
+- if (ty + HEIGHT(c) < m->wh)
+- 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;
+ }
+ }
+
+diff --git a/patches/04.dwm-fullgaps-6.2.diff b/patches/04.dwm-fullgaps-6.2.diff
+index c09a1a9..e69de29 100644
+--- a/patches/04.dwm-fullgaps-6.2.diff
++++ b/patches/04.dwm-fullgaps-6.2.diff
+@@ -1,97 +0,0 @@
+-diff --git a/config.def.h b/config.def.h
+-index 1c0b587..38d2f6c 100644
+---- a/config.def.h
+-+++ b/config.def.h
+-@@ -2,6 +2,7 @@
+-
+- /* appearance */
+- static const unsigned int borderpx = 1; /* border pixel of windows */
+-+static const unsigned int gappx = 15; /* 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 */
+-@@ -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
+-@@ -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];
+-@@ -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);
+-@@ -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);
+-@@ -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)
+- {
+-@@ -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);
+-- if (my + HEIGHT(c) < m->wh)
+-- 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);
+-- if (ty + HEIGHT(c) < m->wh)
+-- 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/patches/04.dwm-fullgaps-6.2.diff b/patches/04.dwm-fullgaps-6.2.diff
deleted file mode 100644
index c09a1a9..0000000
--- a/patches/04.dwm-fullgaps-6.2.diff
+++ /dev/null
@@ -1,97 +0,0 @@
-diff --git a/config.def.h b/config.def.h
-index 1c0b587..38d2f6c 100644
---- a/config.def.h
-+++ b/config.def.h
-@@ -2,6 +2,7 @@
-
- /* appearance */
- static const unsigned int borderpx = 1; /* border pixel of windows */
-+static const unsigned int gappx = 15; /* 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 */
-@@ -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
-@@ -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];
-@@ -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);
-@@ -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);
-@@ -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)
- {
-@@ -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);
-- if (my + HEIGHT(c) < m->wh)
-- 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);
-- if (ty + HEIGHT(c) < m->wh)
-- 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
-