diff options
| author | Alexander Leonhardt <equinox.salexander@gmail.com> | |
|---|---|---|
| 2026-09-15 20:04:14 +0200 | ||
| committer | Alexander Leonhardt <equinox.salexander@gmail.com> | |
| 2026-09-15 20:04:14 +0200 | ||
| commit | ecc32af034e964539cf46776b07054258387d5a7 (patch) | |
| tree | 1fd8a0e7405689b1b9c6ef21d6f700e6cdb85e1c | |
| parent | 1340e17f9fc15862282c095798e7b4471ebf9cda (diff) | |
| download | dwl-ecc32af034e964539cf46776b07054258387d5a7.tar.gz dwl-ecc32af034e964539cf46776b07054258387d5a7.tar.bz2 dwl-ecc32af034e964539cf46776b07054258387d5a7.zip | |
Allowed matching against description
Added the gaps patch
Allowed matching against description
Added the gaps patch
diff --git a/config.def.h b/config.def.h index 0e7c7e9..946551a 100644 --- a/config.def.h +++ b/config.def.h @@ -6,6 +6,9 @@ /* appearance */ static const int sloppyfocus = 0; /* focus follows mouse */ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ +static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */ +static int gaps = 1; /* 1 means gaps between windows are added */ +static const unsigned int gappx = 10; /* gap pixel between windows */ static const unsigned int borderpx = 1; /* border pixel of windows */ static const int centeredmaster_always = 0; /* always center even if only 1 window */ static const float rootcolor[] = COLOR(0x222222ff); @@ -225,6 +225,7 @@ struct Monitor { struct wl_list layers[4]; /* LayerSurface.link */ const Layout *lt[2]; Pertag *pertag; + int gaps; unsigned int seltags; unsigned int sellt; uint32_t tagset[2]; @@ -1334,6 +1335,8 @@ createmon(struct wl_listener *listener, void *data) wlr_output_state_init(&state); /* Initialize monitor state using configured rules */ + m->gaps = gaps; + m->tagset[0] = m->tagset[1] = 1; for (r = monrules; r < END(monrules); r++) { if (!r->name || strstr(wlr_output->name, r->name) || ((wlr_output->description != NULL) && strstr(wlr_output->description,r->name))) { @@ -3312,7 +3315,7 @@ tagmon(const Arg *arg) void tile(Monitor *m) { - unsigned int mw, my, ty; + unsigned int h, r, e = m->gaps, mw, my, ty; int i, n = 0; Client *c; @@ -3321,23 +3324,30 @@ tile(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 = my = ty = 0; + i = 0; + my = 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, .y = m->w.y + my, .width = mw, - .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0); - my += c->geom.height; + 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 - 2*gappx*e, .height = h}, 0); + my += c->geom.height + 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++; } @@ -3370,6 +3380,13 @@ togglefullscreen(const Arg *arg) } void +togglegaps(const Arg *arg) +{ + selmon->gaps = !selmon->gaps; + arrange(selmon); +} + +void toggletag(const Arg *arg) { uint32_t newtags; |