aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/dwm-gaplessgrid-pertag-gaps.diff39
-rw-r--r--patches/dwm-gaps-pertag.diff163
-rw-r--r--patches/dwm-remove-dmenu.diff30
3 files changed, 232 insertions, 0 deletions
diff --git a/patches/dwm-gaplessgrid-pertag-gaps.diff b/patches/dwm-gaplessgrid-pertag-gaps.diff
new file mode 100644
index 0000000..e38f041
--- /dev/null
+++ b/patches/dwm-gaplessgrid-pertag-gaps.diff
@@ -0,0 +1,39 @@
+From d15f7fd6781e8916538efcb62011167d5b540ada Mon Sep 17 00:00:00 2001
+From: Aryadev Chavali <aryadev@aryadevchavali.com>
+Date: Wed, 22 May 2024 12:58:03 +0530
+Subject: [PATCH] [PATCH] Adjust gapless grid for pertag gaps
+
+---
+ gaplessgrid.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/gaplessgrid.c b/gaplessgrid.c
+index 649f656..3c9ad76 100644
+--- a/gaplessgrid.c
++++ b/gaplessgrid.c
+@@ -15,6 +15,7 @@ gaplessgrid(Monitor *m) {
+ cols = 2;
+ rows = n/cols;
+
++ const int gap_size = m->pertag->gaps[m->pertag->curtag];
+ /* window geometries */
+ cw = cols ? m->ww / cols : m->ww;
+ cn = 0; /* current column number */
+@@ -22,10 +23,10 @@ gaplessgrid(Monitor *m) {
+ for(i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
+ if(i/rows + 1 > cols - n%cols)
+ rows = n/cols + 1;
+- ch = (rows ? m->wh / rows : m->wh) - m->gappx;
+- cx = (m->wx + cn*cw) + m->gappx;
+- cy = (m->wy + rn*ch) + m->gappx;
+- resize(c, cx + m->gappx, cy + m->gappx, cw - 2 * c->bw - m->gappx, ch - 2 * c->bw - m->gappx, False);
++ ch = (rows ? m->wh / rows : m->wh) - gap_size;
++ cx = (m->wx + cn*cw) + gap_size;
++ cy = (m->wy + rn*ch) + gap_size;
++ resize(c, cx + gap_size, cy + gap_size, cw - 2 * c->bw - gap_size, ch - 2 * c->bw - gap_size, False);
+ rn++;
+ if(rn >= rows) {
+ rn = 0;
+--
+2.45.0
+
diff --git a/patches/dwm-gaps-pertag.diff b/patches/dwm-gaps-pertag.diff
new file mode 100644
index 0000000..c5f1221
--- /dev/null
+++ b/patches/dwm-gaps-pertag.diff
@@ -0,0 +1,163 @@
+From f8aa7781bb890992b75fbc2c9039e2477f1a09c6 Mon Sep 17 00:00:00 2001
+From: Aryadev Chavali <aryadev@aryadevchavali.com>
+Date: Wed, 22 May 2024 12:55:50 +0530
+Subject: [PATCH] [PATCH] Gaps are set on a pertag basis
+
+For each tag there is a gap (set to the default gappx on
+construction). When adjusting gaps or arranging a monitor use the
+gaps of the currently selected tag. This means I can have gaps
+activated in some tags and not activated on others.
+---
+ dwm.c | 64 ++++++++++++++++++++++++++++++++---------------------------
+ 1 file changed, 35 insertions(+), 29 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index af66670..c9dd38a 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -122,7 +122,6 @@ 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];
+@@ -287,16 +286,19 @@ static Monitor *mons, *selmon;
+ static Window root, wmcheckwin;
+
+ /* configuration, allows nested code to access above variables */
+-#include "config.h"
++// TODO: Figure out if there is a better way of doing this
++#define TAG_SIZE 9
+ struct Pertag {
+ unsigned int curtag, prevtag; /* current and previous tag */
+- int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
+- float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
+- unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
+- const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
+- int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
++ int nmasters[TAG_SIZE + 1]; /* number of windows in master area */
++ float mfacts[TAG_SIZE + 1]; /* mfacts per tag */
++ unsigned int sellts[TAG_SIZE + 1]; /* selected layouts */
++ const Layout *ltidxs[TAG_SIZE + 1][2]; /* matrix of tags and layouts indexes */
++ int showbars[TAG_SIZE + 1]; /* display bar for the current tag */
++ int gaps[TAG_SIZE + 1]; /* size of gaps for the current tag*/
+ };
+
++#include "config.h"
+
+ static unsigned int scratchtag = 1 << LENGTH(tags);
+
+@@ -715,7 +717,6 @@ 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);
+@@ -731,6 +732,7 @@ createmon(void)
+ m->pertag->sellts[i] = m->sellt;
+
+ m->pertag->showbars[i] = m->showbar;
++ m->pertag->gaps[i] = gappx;
+ }
+
+ return m;
+@@ -748,7 +750,7 @@ destroynotify(XEvent *e)
+
+ void
+ deck(Monitor *m) {
+- unsigned int i, n, h, mw, my, ns;
++ unsigned int i, n, h, mw, my, ns, gap_size;
+ Client *c;
+
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+@@ -763,15 +765,16 @@ deck(Monitor *m) {
+ mw = m->ww;
+ ns = 1;
+ }
+- for(i = 0, my = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++
++ gap_size = m->pertag->gaps[m->pertag->curtag];
++ for(i = 0, my = gap_size, 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);
+- if (my + HEIGHT(c) < m->wh)
+- my += HEIGHT(c) + m->gappx;
++ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gap_size;
++ resize(c, m->wx + gap_size, m->wy + my, mw - (2*c->bw) - gap_size*(5-ns)/2, h - (2*c->bw), False);
++ my += HEIGHT(c) + gap_size;
+ }
+ 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);
++ resize(c, m->wx + mw + gap_size/ns, m->wy + gap_size, m->ww - mw - (2*c->bw) - gap_size*(5-ns)/2, m->wh - (2*c->bw) - 2*gap_size, False);
+ }
+
+ void
+@@ -1243,10 +1246,11 @@ monocle(Monitor *m)
+ n++;
+ if (n > 0) /* override layout symbol */
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
++ const int gap_size = m->pertag->gaps[m->pertag->curtag];
+ for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
+- resize(c, m->wx + m->gappx, m->wy + m->gappx,
+- m->ww - 2 * c->bw - (2 * m->gappx),
+- m->wh - 2 * c->bw - (2 * m->gappx),
++ resize(c, m->wx + gap_size, m->wy + gap_size,
++ m->ww - 2 * c->bw - (2 * gap_size),
++ m->wh - 2 * c->bw - (2 * gap_size),
+ 0);
+ }
+
+@@ -1646,10 +1650,11 @@ setfullscreen(Client *c, int fullscreen)
+ void
+ setgaps(const Arg *arg)
+ {
+- if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
+- selmon->gappx = 0;
++ int *gap_size = &selmon->pertag->gaps[selmon->pertag->curtag];
++ if ((arg->i == 0) || ((*gap_size) + arg->i < 0))
++ *gap_size = 0;
+ else
+- selmon->gappx += arg->i;
++ *gap_size += arg->i;
+ arrange(selmon);
+ }
+
+@@ -1839,21 +1844,22 @@ tile(Monitor *m)
+ if (n == 0)
+ return;
+
++ const int gap_size = m->pertag->gaps[m->pertag->curtag];
+ if (n > m->nmaster)
+ mw = m->nmaster ? m->ww * m->mfact : 0;
+ else
+- mw = m->ww - m->gappx;
+- for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++ mw = m->ww - gap_size;
++ for (i = 0, my = ty = gap_size, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < m->nmaster) {
+- 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);
++ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gap_size;
++ resize(c, m->wx + gap_size, m->wy + my, mw - (2*c->bw) - gap_size, h - (2*c->bw), 0);
+ if (my + HEIGHT(c) < m->wh)
+- my += HEIGHT(c) + m->gappx;
++ my += HEIGHT(c) + gap_size;
+ } else {
+- 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);
++ h = (m->wh - ty) / (n - i) - gap_size;
++ resize(c, m->wx + mw + gap_size, m->wy + ty, m->ww - mw - (2*c->bw) - 2*gap_size, h - (2*c->bw), 0);
+ if (ty + HEIGHT(c) < m->wh)
+- ty += HEIGHT(c) + m->gappx;
++ ty += HEIGHT(c) + gap_size;
+ }
+ }
+
+--
+2.45.0
+
diff --git a/patches/dwm-remove-dmenu.diff b/patches/dwm-remove-dmenu.diff
new file mode 100644
index 0000000..f0fac2a
--- /dev/null
+++ b/patches/dwm-remove-dmenu.diff
@@ -0,0 +1,30 @@
+From 6fc206cb7cce97f947d121b5ce80b665bcc37a6f Mon Sep 17 00:00:00 2001
+From: Aryadev Chavali <aryadev@aryadevchavali.com>
+Date: Wed, 22 May 2024 12:27:59 +0530
+Subject: [PATCH] [Patch] Remove dmenu functionality from DWM
+
+If using an external keyboard client such as sxhkdrc then dwm has no
+business or need to spawn something like dmenu.
+---
+ config.h | 2 --
+ dwm.c | 4 +---
+ 2 files changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index a6aaace..af66670 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -1795,10 +1795,7 @@ sigchld(int unused)
+ void
+ spawn(const Arg *arg)
+ {
+- if (arg->v == dmenucmd)
+- dmenumon[0] = '0' + selmon->num;
+- else if (arg->v == statuscmd) {
++ if (arg->v == statuscmd) {
+ statuscmd[2] = statuscmds[statuscmdn];
+ setenv("BUTTON", lastbutton, 1);
+ }
+--
+2.45.0
+