This commit is contained in:
peesock 2024-06-24 20:29:53 -07:00
parent b629632b7c
commit 12eaafa1c3
2 changed files with 26 additions and 26 deletions

View File

@ -4,10 +4,11 @@ Adds gaps between clients, providing the ability to disable them at run-time.
`smartgaps` can also be changed to remove gaps when there is only one client present.
### Download
- [git branch](https://codeberg.org/sewn/dwl/src/branch/gaps)
- [2024-04-01](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaps/gaps.patch)
- [git branch](https://codeberg.org/bigman/dwl/src/branch/gaps)
- [2024-06-24](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/gaps/gaps.patch)
### Authors
- [peesock](https://codeberg.org/bigman)
- [sewn](https://codeberg.org/sewn)
- [Serene Void](https://github.com/serenevoid)
- [Rayan Nakib](https://nakibrayan2.pages.dev)

View File

@ -1,16 +1,17 @@
From c814a3f16995a2fe8542c5bbdb28e38e7de5ef7e Mon Sep 17 00:00:00 2001
From: sewn <sewn@disroot.org>
Date: Sun, 15 Oct 2023 09:38:16 +0100
Subject: [PATCH] introduce gaps with functionality of useless gaps from dwm
From b70e7e26d74e4f46b48f0d3ed67c8e9465d86c4e Mon Sep 17 00:00:00 2001
From: peesock <kcormn@gmail.com>
Date: Mon, 24 Jun 2024 20:06:42 -0700
Subject: [PATCH] gaps!
Co-authored-by: sewn <sewn@disroot.org>
Co-authored-by: serenevoid <ajuph9224@gmail.com>
---
config.def.h | 4 ++++
dwl.c | 38 ++++++++++++++++++++++++++++----------
2 files changed, 32 insertions(+), 10 deletions(-)
dwl.c | 34 ++++++++++++++++++++++++++--------
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/config.def.h b/config.def.h
index 8847e58..dca0a46 100644
index 646a3d6..1983e53 100644
--- a/config.def.h
+++ b/config.def.h
@@ -6,6 +6,9 @@
@ -23,7 +24,7 @@ index 8847e58..dca0a46 100644
static const unsigned int borderpx = 1; /* border pixel of windows */
static const float rootcolor[] = COLOR(0x222222ff);
static const float bordercolor[] = COLOR(0x444444ff);
@@ -130,6 +133,7 @@ static const Key keys[] = {
@@ -134,6 +137,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
{ MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
@ -32,10 +33,10 @@ index 8847e58..dca0a46 100644
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
diff --git a/dwl.c b/dwl.c
index 39ce68c..2d317c5 100644
index 00e9cc1..9a3bf1d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -198,6 +198,7 @@ struct Monitor {
@@ -200,6 +200,7 @@ struct Monitor {
struct wlr_box w; /* window area, layout-relative */
struct wl_list layers[4]; /* LayerSurface.link */
const Layout *lt[2];
@ -43,7 +44,7 @@ index 39ce68c..2d317c5 100644
unsigned int seltags;
unsigned int sellt;
uint32_t tagset[2];
@@ -332,6 +333,7 @@ static void tagmon(const Arg *arg);
@@ -338,6 +339,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
@ -51,7 +52,7 @@ index 39ce68c..2d317c5 100644
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data);
@@ -881,6 +883,8 @@ createmon(struct wl_listener *listener, void *data)
@@ -936,6 +938,8 @@ createmon(struct wl_listener *listener, void *data)
wlr_output_state_init(&state);
/* Initialize monitor state using configured rules */
@ -60,7 +61,7 @@ index 39ce68c..2d317c5 100644
m->tagset[0] = m->tagset[1] = 1;
for (r = monrules; r < END(monrules); r++) {
if (!r->name || strstr(wlr_output->name, r->name)) {
@@ -2572,7 +2576,7 @@ tagmon(const Arg *arg)
@@ -2626,7 +2630,7 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
@ -69,7 +70,7 @@ index 39ce68c..2d317c5 100644
int i, n = 0;
Client *c;
@@ -2581,23 +2585,30 @@ tile(Monitor *m)
@@ -2635,23 +2639,30 @@ tile(Monitor *m)
n++;
if (n == 0)
return;
@ -80,9 +81,8 @@ index 39ce68c..2d317c5 100644
- mw = m->nmaster ? ROUND(m->w.width * m->mfact) : 0;
+ mw = m->nmaster ? ROUND((m->w.width + gappx*e) * m->mfact) : 0;
else
- mw = m->w.width;
mw = m->w.width;
- i = my = ty = 0;
+ mw = m->w.width - 2*gappx*e + gappx*e;
+ i = 0;
+ my = ty = gappx*e;
wl_list_for_each(c, &clients, link) {
@ -95,21 +95,20 @@ index 39ce68c..2d317c5 100644
+ r = MIN(n, m->nmaster) - i;
+ h = (m->w.height - my - gappx*e - gappx*e * (r - 1)) / r;
+ resize(c, (struct wlr_box){.x = m->w.x + gappx*e, .y = m->w.y + my,
+ .width = mw - gappx*e, .height = h}, 0);
+ .width = mw - 2*gappx*e, .height = h}, 0);
+ my += c->geom.height + gappx*e;
} else {
- resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
- .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
- ty += c->geom.height;
+ r = n - i;
+ h = (m->w.height - ty - gappx*e - gappx*e * (r - 1)) / r;
+ resize(c, (struct wlr_box){.x = m->w.x + mw + gappx*e, .y = m->w.y + ty,
+ .width = m->w.width - mw - 2*gappx*e, .height = h}, 0);
resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
- .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
- ty += c->geom.height;
+ .width = m->w.width - mw - gappx*e, .height = h}, 0);
+ ty += c->geom.height + gappx*e;
}
i++;
}
@@ -2620,6 +2631,13 @@ togglefullscreen(const Arg *arg)
@@ -2674,6 +2685,13 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen);
}
@ -124,5 +123,5 @@ index 39ce68c..2d317c5 100644
toggletag(const Arg *arg)
{
--
2.44.0
2.45.2