refactor: improve app quit in windows

This commit is contained in:
Carlos Valente
2026-03-21 17:01:23 +01:00
committed by Carlos Valente
parent b2b7855114
commit ef5c0a371e
+6 -4
View File
@@ -28,7 +28,7 @@ const {
function getApplicationMenu(askToQuit, clientUrl, serverUrl, redirectWindow, showDialog, download) { function getApplicationMenu(askToQuit, clientUrl, serverUrl, redirectWindow, showDialog, download) {
const template = [ const template = [
...(isMac ? [makeMacMenu(askToQuit)] : []), ...(isMac ? [makeMacMenu(askToQuit)] : []),
makeFileMenu(serverUrl, redirectWindow, showDialog, download), makeFileMenu(askToQuit, serverUrl, redirectWindow, showDialog, download),
makeEditMenu(), makeEditMenu(),
makeViewMenu(clientUrl), makeViewMenu(clientUrl),
makeSettingsMenu(redirectWindow), makeSettingsMenu(redirectWindow),
@@ -56,7 +56,7 @@ function makeMacMenu(askToQuit) {
{ {
label: 'Quit', label: 'Quit',
click: askToQuit, click: askToQuit,
accelerator: isMac ? 'Cmd+Q' : 'Alt+F4', accelerator: 'Cmd+Q',
}, },
], ],
}; };
@@ -86,7 +86,7 @@ function makeEditMenu() {
* @param {function} download - function to download a resource from url * @param {function} download - function to download a resource from url
* @returns {Object} * @returns {Object}
*/ */
function makeFileMenu(serverUrl, redirectWindow, showDialog, download) { function makeFileMenu(askToQuit, serverUrl, redirectWindow, showDialog, download) {
const downloadProject = () => { const downloadProject = () => {
try { try {
download(serverUrl + downloadPath); download(serverUrl + downloadPath);
@@ -134,7 +134,9 @@ function makeFileMenu(serverUrl, redirectWindow, showDialog, download) {
], ],
}, },
{ type: 'separator' }, { type: 'separator' },
{ role: isMac ? 'close' : 'quit' }, isMac
? { role: 'close' }
: { label: 'Quit', click: askToQuit, accelerator: 'Alt+F4' },
], ],
}; };
} }