prevent an infinite loop if try to use focusmon() with all monitors disabled

main
Leonardo Hernández Hernández 2022-08-13 19:57:20 -05:00
parent dfcd142ce4
commit 406aebcbd2
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
1 changed files with 5 additions and 3 deletions

8
dwl.c
View File

@ -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);
}