From 1587a40514932dfb5309e06f891d27a42151963a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Desgualdo=20Pereira?= Date: Fri, 1 May 2026 08:20:19 -0300 Subject: [PATCH] minor improvement on swapfocus patch --- patches/swapfocus/swapfocus.patch | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/patches/swapfocus/swapfocus.patch b/patches/swapfocus/swapfocus.patch index bd262e9..17b62c0 100644 --- a/patches/swapfocus/swapfocus.patch +++ b/patches/swapfocus/swapfocus.patch @@ -1,12 +1,12 @@ -From 34c613a77683ab0e2beac36276315d037ba222a5 Mon Sep 17 00:00:00 2001 +From c4a9254ef63bbe1bae9ed525250e0b187668397f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Desgualdo=20Pereira?= -Date: Thu, 30 Apr 2026 13:36:03 -0300 -Subject: [PATCH] add swapfocus patch +Date: Fri, 1 May 2026 08:17:28 -0300 +Subject: [PATCH] swapfocus patch improvement --- config.def.h | 1 + - dwl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 46 insertions(+) + dwl.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 48 insertions(+) diff --git a/config.def.h b/config.def.h index 8a6eda0..23e502d 100644 @@ -21,7 +21,7 @@ index 8a6eda0..23e502d 100644 { MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} }, diff --git a/dwl.c b/dwl.c -index 101a45f..dac34a6 100644 +index 101a45f..5e78719 100644 --- a/dwl.c +++ b/dwl.c @@ -332,6 +332,7 @@ static void setsel(struct wl_listener *listener, void *data); @@ -61,7 +61,7 @@ index 101a45f..dac34a6 100644 /* Put the new client atop the focus stack and select its monitor */ if (c && !client_is_unmanaged(c)) { wl_list_remove(&c->flink); -@@ -2679,6 +2688,42 @@ spawn(const Arg *arg) +@@ -2679,6 +2688,44 @@ spawn(const Arg *arg) } } @@ -71,14 +71,13 @@ index 101a45f..dac34a6 100644 + Client *c; + int found = 0; + -+ if (!prevclient) -+ return; -+ + /* Verify the client still exists in the list of managed windows */ -+ wl_list_for_each(c, &clients, link) { -+ if (c == prevclient) { -+ found = 1; -+ break; ++ if (prevclient) { ++ wl_list_for_each(c, &clients, link) { ++ if (c == prevclient) { ++ found = 1; ++ break; ++ } + } + } + @@ -98,6 +97,9 @@ index 101a45f..dac34a6 100644 + /* Tag IS visible: Just swap focus within the same view */ + focusclient(prevclient, 1); + } ++ } else { ++ Arg a = {.ui = 0}; ++ view(&a); + } +} +