From 6fe0c4be6ceb86571ff3356a426453ad130df029 Mon Sep 17 00:00:00 2001 From: pengx17 Date: Mon, 15 Apr 2024 05:44:57 +0000 Subject: [PATCH] fix(electron): close app while on fullscreen should be minimize instead (#6534) --- packages/frontend/electron/src/main/main-window.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/frontend/electron/src/main/main-window.ts b/packages/frontend/electron/src/main/main-window.ts index ec7005d2d3..d4db3fd8bd 100644 --- a/packages/frontend/electron/src/main/main-window.ts +++ b/packages/frontend/electron/src/main/main-window.ts @@ -127,7 +127,14 @@ async function createWindow(additionalArguments: string[]) { // - all browser windows will capture the "close" event // - the hidden window will close all windows // - "window-all-closed" event will be emitted and eventually quit the app - browserWindow.hide(); + if (browserWindow.isFullScreen()) { + browserWindow.once('leave-full-screen', () => { + browserWindow.hide(); + }); + browserWindow.setFullScreen(false); + } else { + browserWindow.hide(); + } } helperConnectionUnsub?.(); helperConnectionUnsub = undefined;