Update swallow patch

This commit is contained in:
Nikita Ivanov 2025-03-22 18:34:36 +01:00
parent 77b45273bf
commit 4f98041841
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
3 changed files with 20 additions and 18 deletions

View File

@ -10,8 +10,8 @@ line by avoiding cluttering the screen with many unusable terminals.
`foot` is the terminal by default, you can change it in client rules in config.h.
In `2025-03-03 v0.7` version, the patch had been rewritten from scratch to make
it more robust and add a few more features:
In `2025-03-03 v0.7` version and above, the patch had been rewritten from
scratch to make it more robust and add a few more features:
- "dynamically swallow" windows by pressing `Alt+a` (a focused window will
swallow/unswallow the previously focused one)
@ -22,8 +22,8 @@ it more robust and add a few more features:
#### swallow.patch
- [git branch](https://codeberg.org/nikitaivanov/dwl/src/branch/swallow)
- [2025-03-03 v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/swallow/swallow.patch) (added "dynamic swallowing support")
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/swallow/swallow.patch)
- [2025-03-03 v0.7](https://codeberg.org/dwl/dwl-patches/raw/commit/2e5748edfe1129f95c7bb1bf9dd590a897f55f57/patches/swallow/swallow.patch) (added "dynamic swallowing" support)
- [2024-07-13](https://codeberg.org/dwl/dwl-patches/raw/commit/f1ed83eaeba46108f4ee8164094cb431d64a3e68/patches/swallow/swallow.patch)
- [2024-07-13](https://codeberg.org/dwl/dwl-patches/raw/commit/f64d701bab2f9f52d3637edd091684f920407d87/patches/swallow/swallow.patch)
- [2024-05-02](https://codeberg.org/dwl/dwl-patches/raw/commit/9c5d5d85f3ac780e7a14d5d0535e3349ce8b8f53/patches/swallow/swallow.patch)
@ -39,7 +39,8 @@ it more robust and add a few more features:
Apply this patch on top of the swallow.patch if you use FreeBSD.
- [2025-03-03 v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/swallow/swallow-freebsd.patch)
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/swallow/swallow-freebsd.patch)
- [2025-03-03 v0.7](https://codeberg.org/dwl/dwl-patches/raw/commit/2e5748edfe1129f95c7bb1bf9dd590a897f55f57/patches/swallow/swallow-freebsd.patch) (added "dynamic swallowing" support)
- [2024-07-13](https://codeberg.org/dwl/dwl-patches/raw/commit/f1ed83eaeba46108f4ee8164094cb431d64a3e68/patches/swallow/swallow-freebsd.patch)
### Authors

View File

@ -1,4 +1,4 @@
From 002e11e197cd254f06b65681ffd5bcf617d830b9 Mon Sep 17 00:00:00 2001
From 301e1b368d92a32a7bdcd4bd1f0ede0295977e3e Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Mon, 3 Mar 2025 19:49:07 +0100
Subject: [PATCH] swallow: add FreeBSD support
@ -8,7 +8,7 @@ Subject: [PATCH] swallow: add FreeBSD support
1 file changed, 17 insertions(+)
diff --git a/dwl.c b/dwl.c
index bbbbe6f..dc55319 100644
index 71d500a..52fdd9c 100644
--- a/dwl.c
+++ b/dwl.c
@@ -67,6 +67,14 @@
@ -50,5 +50,5 @@ index bbbbe6f..dc55319 100644
void
--
2.48.1
2.49.0

View File

@ -1,13 +1,13 @@
From 7255d7e2e1b87c0583a202ea20c83fa75466c0fc Mon Sep 17 00:00:00 2001
From a220e1ed4b04a66c837dfc8e3363d3e696cbf541 Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Wed, 5 Feb 2025 02:34:39 +0100
Subject: [PATCH] Swallow: hide the terminal when it spawns a client
---
client.h | 12 ++++
config.def.h | 10 +++-
config.def.h | 11 +++-
dwl.c | 152 +++++++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 167 insertions(+), 7 deletions(-)
3 files changed, 168 insertions(+), 7 deletions(-)
diff --git a/client.h b/client.h
index 42f225f..bc9cad2 100644
@ -33,18 +33,19 @@ index 42f225f..bc9cad2 100644
client_get_clip(Client *c, struct wlr_box *clip)
{
diff --git a/config.def.h b/config.def.h
index 22d2171..fb5f8fb 100644
index 22d2171..42342f1 100644
--- a/config.def.h
+++ b/config.def.h
@@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff);
@@ -13,6 +13,8 @@ static const float focuscolor[] = COLOR(0x005577ff);
static const float urgentcolor[] = COLOR(0xff0000ff);
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
+static int enableautoswallow = 1; /* enables autoswallowing newly spawned clients */
+static float swallowborder = 1.0f; /* add this multiplied by borderpx to border when a client is swallowed */
/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9)
@@ -22,10 +23,11 @@ static int log_level = WLR_ERROR;
@@ -22,10 +24,11 @@ static int log_level = WLR_ERROR;
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
static const Rule rules[] = {
@ -59,7 +60,7 @@ index 22d2171..fb5f8fb 100644
};
/* layout(s) */
@@ -142,6 +144,8 @@ static const Key keys[] = {
@@ -142,6 +145,8 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
@ -69,7 +70,7 @@ index 22d2171..fb5f8fb 100644
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
diff --git a/dwl.c b/dwl.c
index def2562..bbbbe6f 100644
index def2562..71d500a 100644
--- a/dwl.c
+++ b/dwl.c
@@ -73,12 +73,13 @@
@ -83,7 +84,7 @@ index def2562..bbbbe6f 100644
#define TAGMASK ((1u << TAGCOUNT) - 1)
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
+#define BORDERPX(C) (borderpx + ((C)->swallowing ? (C)->swallowing->bw : 0))
+#define BORDERPX(C) (borderpx + ((C)->swallowing ? (int)ceilf(swallowborder * (C)->swallowing->bw) : 0))
/* enums */
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
@ -346,5 +347,5 @@ index def2562..bbbbe6f 100644
if (c == exclusive_focus) {
exclusive_focus = NULL;
--
2.48.1
2.49.0