mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
macOS: change window close behavior, like other macOS App (#999)
This commit is contained in:
parent
2492456b93
commit
0b7d4bfb6a
1 changed files with 8 additions and 6 deletions
|
|
@ -421,9 +421,6 @@ async function createWindow(first = true): Promise<void> {
|
||||||
store.set('fullscreen', mainWindow?.isFullScreen());
|
store.set('fullscreen', mainWindow?.isFullScreen());
|
||||||
|
|
||||||
if (!exitFromTray && store.get('window_exit_to_tray')) {
|
if (!exitFromTray && store.get('window_exit_to_tray')) {
|
||||||
if (isMacOS() && !forceQuit) {
|
|
||||||
exitFromTray = true;
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
mainWindow?.hide();
|
mainWindow?.hide();
|
||||||
}
|
}
|
||||||
|
|
@ -432,8 +429,6 @@ async function createWindow(first = true): Promise<void> {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
saved = true;
|
saved = true;
|
||||||
|
|
||||||
getMainWindow()?.webContents.send('renderer-save-queue');
|
|
||||||
|
|
||||||
ipcMain.once('player-save-queue', async (_event, data: Record<string, any>) => {
|
ipcMain.once('player-save-queue', async (_event, data: Record<string, any>) => {
|
||||||
const queueLocation = join(app.getPath('userData'), 'queue');
|
const queueLocation = join(app.getPath('userData'), 'queue');
|
||||||
const serialized = JSON.stringify(data);
|
const serialized = JSON.stringify(data);
|
||||||
|
|
@ -457,12 +452,19 @@ async function createWindow(first = true): Promise<void> {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('error saving queue state: ', error);
|
console.error('error saving queue state: ', error);
|
||||||
} finally {
|
} finally {
|
||||||
|
if (!isMacOS()) {
|
||||||
mainWindow?.close();
|
mainWindow?.close();
|
||||||
|
}
|
||||||
if (forceQuit) {
|
if (forceQuit) {
|
||||||
app.exit();
|
app.exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
getMainWindow()?.webContents.send('renderer-save-queue');
|
||||||
|
} else {
|
||||||
|
if (forceQuit) {
|
||||||
|
app.exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue