From de97ac8a005d23ce88b3acc281a2ac9be50fdc1b Mon Sep 17 00:00:00 2001 From: Cukmekerb Date: Thu, 21 Apr 2022 08:46:49 -0700 Subject: [PATCH] make quit button actually quit app (#123) --- src/scripts/menu.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/scripts/menu.js b/src/scripts/menu.js index e7cda02..9d5623e 100644 --- a/src/scripts/menu.js +++ b/src/scripts/menu.js @@ -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' } {