Created
September 20, 2018 11:54
-
-
Save AxelBohm/07020247fc55e93fd43428e9a5ec5e02 to your computer and use it in GitHub Desktop.
tile gap patch that should apply to withou conflict to dwm-6.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git config.h config.h | |
index 8eee66b..5ee7805 100644 | |
--- config.h | |
+++ config.h | |
@@ -4,6 +4,7 @@ | |
/* appearance */ | |
static const unsigned int borderpx = 2; /* border pixel of windows */ | |
+static const unsigned int gappx = 10; /* gap pixel 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 */ | |
diff --git dwm.c dwm.c | |
index 4465af1..c006234 100644 | |
--- dwm.c | |
+++ dwm.c | |
@@ -1673,26 +1673,29 @@ tagmon(const Arg *arg) | |
void | |
tile(Monitor *m) | |
{ | |
- unsigned int i, n, h, mw, my, ty; | |
+ unsigned int i, n, h, mw, my, ty, ns; | |
Client *c; | |
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); | |
if (n == 0) | |
return; | |
- if (n > m->nmaster) | |
+ if (n > m->nmaster) { | |
mw = m->nmaster ? m->ww * m->mfact : 0; | |
- else | |
+ ns = m->nmaster > 0 ? 2 : 1; | |
+ } else { | |
mw = m->ww; | |
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) | |
+ ns = 1; | |
+ } | |
+ for (i = 0, my = ty = 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) - gappx; | |
+ resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False); | |
+ my += HEIGHT(c) + 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) - gappx; | |
+ resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False); | |
+ ty += HEIGHT(c) + gappx; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment