From a8e9c33c50152294c5fed83af9d1c71f6689c777 Mon Sep 17 00:00:00 2001 From: Bear Date: Wed, 29 Dec 2021 03:30:54 +0000 Subject: fix stickywindow always getting focused --- dwm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 43b37c8..3e1a891 100644 --- a/dwm.c +++ b/dwm.c @@ -1930,8 +1930,11 @@ 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, c); if (c) { -- cgit v1.2.1