make quit button actually quit app (#123)

This commit is contained in:
Cukmekerb 2022-04-21 08:46:49 -07:00 committed by GitHub
parent 82ac5edf22
commit de97ac8a00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
const { Menu } = require("electron");
const { Menu, app } = require("electron");
const { showSettingsWindow } = require("./settings");
const isMac = process.platform === "darwin";
@ -10,6 +10,14 @@ const settingsMenuEntry = {
accelerator: "Control+/",
};
const quitMenuEntry = {
label: "Quit",
click() {
app.exit(0);
},
accelerator: "Control+Q"
};
const mainMenu = [
...(isMac
? [
@ -25,7 +33,7 @@ const mainMenu = [
{ role: "hideothers" },
{ role: "unhide" },
{ type: "separator" },
{ role: "quit" },
quitMenuEntry,
],
},
]
@ -33,7 +41,7 @@ const mainMenu = [
// { role: 'fileMenu' }
{
label: "File",
submenu: [settingsMenuEntry, isMac ? { role: "close" } : { role: "quit" }],
submenu: [settingsMenuEntry, isMac ? { role: "close" } : quitMenuEntry],
},
// { role: 'editMenu' }
{