fix(electron): close app while on fullscreen should be minimize instead (#6534)

This commit is contained in:
pengx17 2024-04-15 05:44:57 +00:00
parent e1eb925704
commit 6fe0c4be6c
No known key found for this signature in database
GPG Key ID: 23F23D9E8B3971ED

View File

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