diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-24 16:21:12 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-24 16:21:12 +0100 |
commit | 7c67af1e810d549c9a85525498217fc40bd92e27 (patch) | |
tree | 9e155e70695ef02ffb597dfcb84c8355ba2ff494 | |
parent | a5ef1a0a857849164ac300520050810e13615f7b (diff) | |
download | dwm-7c67af1e810d549c9a85525498217fc40bd92e27.tar.gz dwm-7c67af1e810d549c9a85525498217fc40bd92e27.tar.bz2 dwm-7c67af1e810d549c9a85525498217fc40bd92e27.zip |
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.
-rw-r--r-- | dwm.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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) { |