Updating sendmon_keepfocus to only keep focus if the client had focus

This commit is contained in:
bakkeby 2020-06-25 10:28:31 +02:00
parent 5a94b44e80
commit 5a4c350b9c

10
dwm.c
View File

@ -2894,6 +2894,9 @@ sendmon(Client *c, Monitor *m)
#endif // EXRESIZE_PATCH
if (c->mon == m)
return;
#if SENDMON_KEEPFOCUS_PATCH && !EXRESIZE_PATCH
int hadfocus = (c == selmon->sel);
#endif // SENDMON_KEEPFOCUS_PATCH
unfocus(c, 1);
detach(c);
detachstack(c);
@ -2920,8 +2923,11 @@ sendmon(Client *c, Monitor *m)
restack(m);
#elif SENDMON_KEEPFOCUS_PATCH
arrange(m);
focus(c);
restack(m);
if (hadfocus) {
focus(c);
restack(m);
} else
focus(NULL);
#else
focus(NULL);
arrange(NULL);