tile gap patch
This commit is contained in:
parent
3082e83593
commit
bf75862bd1
@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int gappx = 18; /* gap pixel 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 standard bar */
|
||||
|
23
dwm.c
23
dwm.c
@ -2233,28 +2233,31 @@ 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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
ty += HEIGHT(c);
|
||||
ty += HEIGHT(c) + gappx;
|
||||
}
|
||||
}
|
||||
|
||||
|
77
patches/appearance/dwm-tilegap-6.4.diff
Normal file
77
patches/appearance/dwm-tilegap-6.4.diff
Normal file
@ -0,0 +1,77 @@
|
||||
From e655302a4bd74c1f2778f94761c87381d1dfc0e2 Mon Sep 17 00:00:00 2001
|
||||
From: midspec <obleque@protonmail.com>
|
||||
Date: Sat, 4 Nov 2023 19:17:50 +0000
|
||||
Subject: [PATCH] Add window-gaps for the tile-layout
|
||||
|
||||
Adds gaps between windows in the tile-layout. The proposed advantage to some
|
||||
other patches which try to accomplish the same goal is that the gap-size between
|
||||
master and stack, window and window, and window and screen-edge is the
|
||||
same. The gap-size can be configured in the config.h with the
|
||||
gappx-variable.
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwm.c | 23 +++++++++++++----------
|
||||
2 files changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9efa774..82ba41f 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 = 18; /* 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 a/dwm.c b/dwm.c
|
||||
index f1d86b2..fa8b3d6 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -1687,28 +1687,31 @@ 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);
|
||||
+ 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);
|
||||
+ 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);
|
||||
+ 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);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
- ty += HEIGHT(c);
|
||||
+ ty += HEIGHT(c) + gappx;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.42.0
|
||||
|
Loading…
Reference in New Issue
Block a user