diff --git a/packages/core/src/electron-main/theia-electron-window.ts b/packages/core/src/electron-main/theia-electron-window.ts index 720865f8f59e1..c116eb0844487 100644 --- a/packages/core/src/electron-main/theia-electron-window.ts +++ b/packages/core/src/electron-main/theia-electron-window.ts @@ -186,10 +186,18 @@ export class TheiaElectronWindow { } protected restoreMaximizedState(): void { - if (this.options.isMaximized) { - this._window.maximize(); + const restore = () => { + if (this.options.isMaximized) { + this._window.maximize(); + } else { + this._window.unmaximize(); + } + }; + + if (this._window.isVisible()) { + restore(); } else { - this._window.unmaximize(); + this._window.once('show', () => restore()); } }