aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-07-24 16:22:21 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-07-24 16:22:21 +0100
commit5f9fcc88d1578fe47b7e6e7a3166b8e8b0f0c9e9 (patch)
treeeec491f45addc78bdb702b10d9302776096b6ded
parent7c67af1e810d549c9a85525498217fc40bd92e27 (diff)
downloaddwm-5f9fcc88d1578fe47b7e6e7a3166b8e8b0f0c9e9.tar.gz
dwm-5f9fcc88d1578fe47b7e6e7a3166b8e8b0f0c9e9.tar.bz2
dwm-5f9fcc88d1578fe47b7e6e7a3166b8e8b0f0c9e9.zip
Add patch for deferring focus
-rw-r--r--patches/dwm-sticky-defer-focus.diff37
1 files changed, 37 insertions, 0 deletions
diff --git a/patches/dwm-sticky-defer-focus.diff b/patches/dwm-sticky-defer-focus.diff
new file mode 100644
index 0000000..ed10e2b
--- /dev/null
+++ b/patches/dwm-sticky-defer-focus.diff
@@ -0,0 +1,37 @@
+From 7c67af1e810d549c9a85525498217fc40bd92e27 Mon Sep 17 00:00:00 2001
+From: Aryadev Chavali <aryadev@aryadevchavali.com>
+Date: Wed, 24 Jul 2024 16:21:12 +0100
+Subject: [PATCH] Defer focusing on sticky windows on switching tags
+
+focus(NULL) is called when switching to a new tag or monitor. I don't
+want sticky windows to get first focus in this situation, hence this
+code. Shamelessly stolen from
+https://github.com/LukeSmithxyz/dwm/issues/152.
+---
+ dwm.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index 1a88bf2..0445327 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -906,8 +906,14 @@ expose(XEvent *e)
+ void
+ focus(Client *c)
+ {
+- if (!c || !ISVISIBLE(c))
+- for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
++ if (!c || !ISVISIBLE(c)) {
++ for (c = selmon->stack; c &&
++ (!ISVISIBLE(c) || (c->issticky && !selmon->sel->issticky));
++ c = c->snext);
++ if (!c) /* No windows found; check for available stickies */
++ for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
++ }
++
+ if (selmon->sel && selmon->sel != c)
+ unfocus(selmon->sel, 0);
+ if (c) {
+--
+2.45.2
+