aboutsummaryrefslogtreecommitdiff
path: root/patches/dwm-gaplessgrid-pertag-gaps.diff
blob: e38f0413f4299fd3346fef3bd7c8926a7cb2e331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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