mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-06-11 10:23:19 +00:00
adds an alternative way to handle swapfocus, not allowing changing tags
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
### Description
|
||||
Swapfocus adds a new function on dwl: a shortcut to change the focus to the last focused window. If the last focused window is in another tag, then the focus will change to that tag.
|
||||
Swapfocus adds a new function on dwl: a shortcut to change the focus to the last focused window.
|
||||
- If the last focused window is in another tag, then the focus will change to that tag.
|
||||
- Alternatively: check the patch and uncomment and comment out the lines instructed to keep the swapfocus shortcut from changing to another tag.
|
||||
|
||||
### Download
|
||||
- [v0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/swapfocus/swapfocus.patch)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
From c4a9254ef63bbe1bae9ed525250e0b187668397f Mon Sep 17 00:00:00 2001
|
||||
From 364b9f20b830886b9c0e6539ddba2cc206a286eb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andr=C3=A9=20Desgualdo=20Pereira?= <desgua@gmail.com>
|
||||
Date: Fri, 1 May 2026 08:17:28 -0300
|
||||
Subject: [PATCH] swapfocus patch improvement
|
||||
Date: Thu, 21 May 2026 09:50:03 -0300
|
||||
Subject: [PATCH] swapfocus patch
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 48 insertions(+)
|
||||
dwl.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 91 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..5e78719 100644
|
||||
index 101a45f..c512323 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..5e78719 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,44 @@ spawn(const Arg *arg)
|
||||
@@ -2679,6 +2688,87 @@ spawn(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,13 +93,56 @@ index 101a45f..5e78719 100644
|
||||
+ Arg a = {.ui = prevclient->tags};
|
||||
+ selmon = prevclient->mon;
|
||||
+ view(&a);
|
||||
+
|
||||
+ /* Comment out the 3 lines above and
|
||||
+ * uncommment the following lines
|
||||
+ * if changing tags isn't desired */
|
||||
+
|
||||
+// int current_tag_clients = 0;
|
||||
+// Client *tmp;
|
||||
+// wl_list_for_each(tmp, &clients, link) {
|
||||
+// /* Make sure it's on the current monitor, visible on the current tag, and mapped */
|
||||
+// if (tmp->mon == selmon && (tmp->tags & selmon->tagset[selmon->seltags]) && !client_is_unmanaged(tmp)) {
|
||||
+// current_tag_clients++;
|
||||
+// }
|
||||
+// }
|
||||
+//
|
||||
+// /* If there's more than 1 window here, mimic Mod+k instead of switching tags */
|
||||
+// if (current_tag_clients > 1) {
|
||||
+// Arg arg_focus = {.i = -1};
|
||||
+// focusstack(&arg_focus);
|
||||
+// }
|
||||
+
|
||||
+ /* End of not changing tags logic */
|
||||
+ } else {
|
||||
+ /* Tag IS visible: Just swap focus within the same view */
|
||||
+ focusclient(prevclient, 1);
|
||||
+ }
|
||||
+ } else {
|
||||
+ Arg a = {.ui = 0};
|
||||
+ selmon = prevclient->mon;
|
||||
+ view(&a);
|
||||
+
|
||||
+ /* Comment out the 3 lines above and
|
||||
+ * uncommment the following lines
|
||||
+ * if changing tags isn't desired */
|
||||
+
|
||||
+ /* use the following if changing tags isn't desired */
|
||||
+// int current_tag_clients = 0;
|
||||
+// Client *tmp;
|
||||
+// wl_list_for_each(tmp, &clients, link) {
|
||||
+// /* Make sure it's on the current monitor, visible on the current tag, and mapped */
|
||||
+// if (tmp->mon == selmon && (tmp->tags & selmon->tagset[selmon->seltags]) && !client_is_unmanaged(tmp)) {
|
||||
+// current_tag_clients++;
|
||||
+// }
|
||||
+// }
|
||||
+//
|
||||
+// /* If there's more than 1 window here, mimic Mod+k instead of switching tags */
|
||||
+// if (current_tag_clients > 1) {
|
||||
+// Arg arg_focus = {.i = -1};
|
||||
+// focusstack(&arg_focus);
|
||||
+// }
|
||||
+ /* end of not changing tags logic */
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user