diff --git a/menu.js b/menu.js index 286838ce..e00f46cc 100644 --- a/menu.js +++ b/menu.js @@ -172,19 +172,21 @@ const mainMenuTemplate = (win) => [ }, }, { type: "separator" }, - { - label: "Toggle DevTools", - // Cannot use "toggleDevTools" role in MacOS - click: () => { - const { webContents } = win; - if (webContents.isDevToolsOpened()) { - webContents.closeDevTools(); - } else { - const devToolsOptions = {}; - webContents.openDevTools(devToolsOptions); - } - }, - }, + is.macOS() ? + { + label: "Toggle DevTools", + // Cannot use "toggleDevTools" role in MacOS + click: () => { + const { webContents } = win; + if (webContents.isDevToolsOpened()) { + webContents.closeDevTools(); + } else { + const devToolsOptions = {}; + webContents.openDevTools(devToolsOptions); + } + }, + } : + { role: "toggleDevTools" }, { label: "Edit config.json", click: () => { @@ -198,41 +200,12 @@ const mainMenuTemplate = (win) => [ { label: "View", submenu: [ - { - label: "Reload", - click: () => { - win.webContents.reload(); - }, - }, - { - label: "Force Reload", - click: () => { - win.webContents.reloadIgnoringCache(); - }, - }, + { role: "reload" }, + { role: "forceReload" }, { type: "separator" }, - { - label: "Zoom In", - click: () => { - win.webContents.setZoomLevel( - win.webContents.getZoomLevel() + 1 - ); - }, - }, - { - label: "Zoom Out", - click: () => { - win.webContents.setZoomLevel( - win.webContents.getZoomLevel() - 1 - ); - }, - }, - { - label: "Reset Zoom", - click: () => { - win.webContents.setZoomLevel(0); - }, - }, + { role: "zoomIn" }, + { role: "zoomOut" }, + { role: "resetZoom" }, ], }, { @@ -261,12 +234,7 @@ const mainMenuTemplate = (win) => [ app.quit(); }, }, - { - label: "Quit App", - click: () => { - app.quit(); - }, - }, + { role: "quit" }, ], }, ]; diff --git a/tray.js b/tray.js index 7d0331f7..b89902ab 100644 --- a/tray.js +++ b/tray.js @@ -63,12 +63,7 @@ module.exports.setUpTray = (app, win) => { app.quit(); }, }, - { - label: "Quit", - click: () => { - app.quit(); - }, - }, + { role: "quit" } ]; const trayMenu = Menu.buildFromTemplate(template); diff --git a/yarn.lock b/yarn.lock index 60a92cfd..f3c62799 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2877,10 +2877,10 @@ cssstyle@^2.2.0: dependencies: cssom "~0.3.6" -custom-electron-titlebar@^3.2.6: - version "3.2.6" - resolved "https://registry.yarnpkg.com/custom-electron-titlebar/-/custom-electron-titlebar-3.2.6.tgz#4cd064efa5020954c09732efa8c667a7ee3636e3" - integrity sha512-P3ZGEr0eouUHqhdBBXllpuy2bFhfSmp+32HQBPcwzujjIsUhQxQj/nCpJiFa4SUGAEp1ifu/icuZdDKNNX72Tw== +custom-electron-titlebar@^3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/custom-electron-titlebar/-/custom-electron-titlebar-3.2.7.tgz#fb249d6180cbda074b1d392bea755fa0743012a8" + integrity sha512-KO/6e3r6YflfNUOzi5QHLwkLHBP+ICtHPo70u/kUIKR8UUkDTPb4a9i19q0uDZQcjkH6oqRvFCz9wEHeEpCgxw== dashdash@^1.12.0: version "1.14.1"