mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-08 12:14:50 +00:00
add mastercolumn-gaps patch to mastercolumn directory
This commit is contained in:
parent
642b2559d5
commit
efa963d24b
@ -1,9 +1,16 @@
|
||||
### Description
|
||||
This patch adds an extra layout to dwl called `mastercol` in which the windows in the master area are arranged in columns of equal size. The number of columns is always nmaster + 1, and the last column is a stack of leftover windows just like the normal tile layout. It effectively acts like the default tiling mode, except provides for vertical instead of horizontal master windows.
|
||||
|
||||
For gaps, apply `mastercolumn-gaps.patch` on top of `mastercolumn.patch` and `gaps.patch`.
|
||||
|
||||
### Download
|
||||
##### `mastercolumn.patch`
|
||||
- [git branch](https://codeberg.org/dsst/dwl/src/branch/mastercolumn)
|
||||
- [2024-07-13](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/mastercolumn/mastercolumn.patch)
|
||||
|
||||
##### `mastercolumn-gaps.patch`
|
||||
- [git branch](https://codeberg.org/dsst/dwl/src/branch/mastercolumn-gaps)
|
||||
- [2024-07-16](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/mastercolumn/mastercolumn-gaps.patch)
|
||||
|
||||
### Authors
|
||||
- [dsst](https://codeberg.org/dsst)
|
||||
|
63
patches/mastercolumn/mastercolumn-gaps.patch
Normal file
63
patches/mastercolumn/mastercolumn-gaps.patch
Normal file
@ -0,0 +1,63 @@
|
||||
From b6f2ee09778cdea8a1450d16bcf24a8a75e10b40 Mon Sep 17 00:00:00 2001
|
||||
From: moe <moemmakki@gmail.com>
|
||||
Date: Tue, 16 Jul 2024 13:56:24 -0400
|
||||
Subject: [PATCH 1/1] add mastercolumn gaps
|
||||
|
||||
---
|
||||
dwl.c | 23 +++++++++++++++--------
|
||||
1 file changed, 15 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index b121094..be33c01 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1755,7 +1755,7 @@ unset_fullscreen:
|
||||
void
|
||||
mastercol(Monitor *m)
|
||||
{
|
||||
- unsigned int mw, mx, ty;
|
||||
+ unsigned int h, w, r, e = m->gaps, mw, mx, ty;
|
||||
int i, n = 0;
|
||||
Client *c;
|
||||
|
||||
@@ -1764,23 +1764,30 @@ mastercol(Monitor *m)
|
||||
n++;
|
||||
if (n == 0)
|
||||
return;
|
||||
+ if (smartgaps == n)
|
||||
+ e = 0;
|
||||
|
||||
if (n > m->nmaster)
|
||||
- mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
|
||||
+ mw = m->nmaster ? (int)roundf((m->w.width + gappx*e) * m->mfact) : 0;
|
||||
else
|
||||
mw = m->w.width;
|
||||
- i = mx = ty = 0;
|
||||
+ i = 0;
|
||||
+ mx = ty = gappx*e;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
if (i < m->nmaster) {
|
||||
- resize(c, (struct wlr_box){.x = m->w.x + mx, .y = m->w.y,
|
||||
- .width = (mw - mx) / (MIN(n, m->nmaster) - i), .height = m->w.height}, 0);
|
||||
- mx += c->geom.width;
|
||||
+ r = MIN(n, m->nmaster) - i;
|
||||
+ w = (mw - mx - gappx*e - gappx*e * (r - 1)) / r;
|
||||
+ resize(c, (struct wlr_box){.x = m->w.x + mx, .y = m->w.y + gappx*e,
|
||||
+ .width = w, .height = m->w.height - 2*gappx*e}, 0);
|
||||
+ mx += c->geom.width + gappx*e;
|
||||
} else {
|
||||
+ 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, .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++;
|
||||
}
|
||||
--
|
||||
2.45.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user