aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dwl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/dwl.c b/dwl.c
index ebb74b8..f76e30f 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1192,9 +1192,11 @@ focusclient(Client *c, int lift)
void
focusmon(const Arg *arg)
{
- do
- selmon = dirtomon(arg->i);
- while (!selmon->wlr_output->enabled);
+ int i = 0, nmons = wl_list_length(&mons);
+ if (nmons)
+ do /* don't switch to disabled mons */
+ selmon = dirtomon(arg->i);
+ while (!selmon->wlr_output->enabled && i++ < nmons);
focusclient(focustop(selmon), 1);
}