Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
fix: prevent crash with Monocle and monocleMinimizeRest when closing …
Browse files Browse the repository at this point in the history
…transient dialogs; ref #110
  • Loading branch information
bladedvox authored and Mikhail Zolotukhin committed Oct 18, 2021
1 parent 935a338 commit 49ac131
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,19 @@ export class TilingController implements Controller {
this.engine.arrange();

// Switch to next window if monocle with config.monocleMinimizeRest
if (!this.currentWindow && this.engine.isLayoutMonocleAndMinimizeRest()) {
this.engine.focusOrder(1, true);
/* HACK: force window to maximize if it isn't already
* This is ultimately to trigger onWindowFocused() at the right time
*/
this.engine.focusOrder(1, true);
this.engine.focusOrder(-1, true);
try {
if (!this.currentWindow && this.engine.isLayoutMonocleAndMinimizeRest()) {
this.engine.focusOrder(1, true);
/* HACK: force window to maximize if it isn't already
* This is ultimately to trigger onWindowFocused() at the right time
*/
this.engine.focusOrder(1, true);
this.engine.focusOrder(-1, true);
}
} catch {
/* HACK for the HACK: transient modals cause an error with the above workaround,
* so if we catch it here and ignore it, all is well */
return;
}
}

Expand Down

0 comments on commit 49ac131

Please sign in to comment.