aboutsummaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c10
1 files 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) {