! Ensure FT stay "running in background" on MacOS after all window closed (#3526)

This commit is contained in:
PikachuEXE 2023-05-12 07:34:20 +08:00 committed by GitHub
parent 8646e93f7f
commit 4363c71ab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -975,7 +975,7 @@ function runApp() {
// ************************************************* //
app.once('window-all-closed', () => {
app.on('window-all-closed', () => {
// Clear cache and storage if it's the last window
session.defaultSession.clearCache()
session.defaultSession.clearStorageData({
@ -991,11 +991,15 @@ function runApp() {
]
})
// For MacOS the app would still "run in background"
// and create new window on event `activate`
if (process.platform !== 'darwin') {
app.quit()
}
})
// MacOS event
// https://www.electronjs.org/docs/latest/api/app#event-activate-macos
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()