mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-19 07:54:59 +01:00
Add user settings for warn before exit
This commit is contained in:
parent
c9c0ceb757
commit
68587e84ed
@ -340,6 +340,12 @@ ipcMain.on('ipcCall', async function(ev, payload) {
|
|||||||
launcher.disable();
|
launcher.disable();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'shouldWarnBeforeExit':
|
||||||
|
ret = store.get('warnBeforeExit', true);
|
||||||
|
break;
|
||||||
|
case 'setWarnBeforeExit':
|
||||||
|
store.set('warnBeforeExit', args[0]);
|
||||||
|
break;
|
||||||
case 'getMinimizeToTrayEnabled':
|
case 'getMinimizeToTrayEnabled':
|
||||||
ret = tray.hasTray();
|
ret = tray.hasTray();
|
||||||
break;
|
break;
|
||||||
@ -921,6 +927,7 @@ app.on('ready', async () => {
|
|||||||
mainWindow = global.mainWindow = null;
|
mainWindow = global.mainWindow = null;
|
||||||
});
|
});
|
||||||
mainWindow.on('close', async (e) => {
|
mainWindow.on('close', async (e) => {
|
||||||
|
if (store.get('warnBeforeExit', true)) {
|
||||||
const shouldCancelCloseRequest = dialog.showMessageBoxSync(mainWindow, {
|
const shouldCancelCloseRequest = dialog.showMessageBoxSync(mainWindow, {
|
||||||
type: "question",
|
type: "question",
|
||||||
buttons: ["Cancel", "Close Element"],
|
buttons: ["Cancel", "Close Element"],
|
||||||
@ -935,6 +942,7 @@ app.on('ready', async () => {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we are not quitting and have a tray icon then minimize to tray
|
// If we are not quitting and have a tray icon then minimize to tray
|
||||||
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
|
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user