mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44: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();
|
||||
}
|
||||
break;
|
||||
case 'shouldWarnBeforeExit':
|
||||
ret = store.get('warnBeforeExit', true);
|
||||
break;
|
||||
case 'setWarnBeforeExit':
|
||||
store.set('warnBeforeExit', args[0]);
|
||||
break;
|
||||
case 'getMinimizeToTrayEnabled':
|
||||
ret = tray.hasTray();
|
||||
break;
|
||||
@ -921,6 +927,7 @@ app.on('ready', async () => {
|
||||
mainWindow = global.mainWindow = null;
|
||||
});
|
||||
mainWindow.on('close', async (e) => {
|
||||
if (store.get('warnBeforeExit', true)) {
|
||||
const shouldCancelCloseRequest = dialog.showMessageBoxSync(mainWindow, {
|
||||
type: "question",
|
||||
buttons: ["Cancel", "Close Element"],
|
||||
@ -935,6 +942,7 @@ app.on('ready', async () => {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// If we are not quitting and have a tray icon then minimize to tray
|
||||
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
|
||||
|
Loading…
Reference in New Issue
Block a user