From d7fae8e19ca461dfb076bdb1427d97a2bdde4386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Sat, 13 Aug 2022 19:57:20 -0500 Subject: [PATCH] prevent an infinite loop if try to use focusmon() with all monitors disabled --- dwl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 40ea05a..36429b7 100644 --- a/dwl.c +++ b/dwl.c @@ -1199,9 +1199,12 @@ focusclient(Client *c, int lift) void focusmon(const Arg *arg) { - do + Monitor *m = selmon; + do { selmon = dirtomon(arg->i); - while (!selmon->wlr_output->enabled); + if (!selmon || selmon == m) + break; + } while (!selmon->wlr_output->enabled); focusclient(focustop(selmon), 1); }