mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-19 07:54:59 +01:00
Attempt to minimise the window first rather than exiting
This commit is contained in:
parent
9cdea580d3
commit
3d18ff16d1
@ -927,6 +927,16 @@ app.on('ready', async () => {
|
|||||||
mainWindow = global.mainWindow = null;
|
mainWindow = global.mainWindow = null;
|
||||||
});
|
});
|
||||||
mainWindow.on('close', async (e) => {
|
mainWindow.on('close', async (e) => {
|
||||||
|
// If we are not quitting and have a tray icon then minimize to tray
|
||||||
|
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
|
||||||
|
// On Mac, closing the window just hides it
|
||||||
|
// (this is generally how single-window Mac apps
|
||||||
|
// behave, eg. Mail.app)
|
||||||
|
e.preventDefault();
|
||||||
|
mainWindow.hide();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (store.get('warnBeforeExit', true)) {
|
if (store.get('warnBeforeExit', true)) {
|
||||||
const shouldCancelCloseRequest = dialog.showMessageBoxSync(mainWindow, {
|
const shouldCancelCloseRequest = dialog.showMessageBoxSync(mainWindow, {
|
||||||
type: "question",
|
type: "question",
|
||||||
@ -941,16 +951,6 @@ app.on('ready', async () => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are not quitting and have a tray icon then minimize to tray
|
|
||||||
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
|
|
||||||
// On Mac, closing the window just hides it
|
|
||||||
// (this is generally how single-window Mac apps
|
|
||||||
// behave, eg. Mail.app)
|
|
||||||
e.preventDefault();
|
|
||||||
mainWindow.hide();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
Loading…
Reference in New Issue
Block a user