about summary refs log tree commit diff stats
diff options
context:
space:
mode:
author2021-12-11 08:33:07 -0500
committer2021-12-11 08:33:07 -0500
commit8306102dacd7a1b2830124e9abf28821ca5a35e8 (patch)
tree7784d5e20d454345c5b37c5f679798062471d5bb
parent80109dbd85342d2764d8a0d18fb32b79aebc9966 (diff)
parent7e843c47ba573ab03a62f06638c297b9da7e5e75 (diff)
downloaddwm-8306102dacd7a1b2830124e9abf28821ca5a35e8.tar.gz
-rw-r--r--dwm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/dwm.c b/dwm.c
index 929f878..d752216 100644
--- a/dwm.c
+++ b/dwm.c
@@ -951,8 +951,13 @@ 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) {