From 3184e8882fd20f8d7afb6da4ada327adef682f75 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Fri, 9 Jul 2021 19:49:21 +0530 Subject: [PATCH] set Application menu for mac support --- src/main.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 4728ed87a..9892c61be 100644 --- a/src/main.ts +++ b/src/main.ts @@ -40,7 +40,6 @@ function createWindow() { icon: appIcon, show: false, // don't show the main window }); - mainWindow.setMenu(buildMenuBar()); const splash = new BrowserWindow({ frame: false, alwaysOnTop: true, @@ -90,6 +89,7 @@ app.on('ready', () => { if (!isDev) { autoUpdater.checkForUpdatesAndNotify(); } + Menu.setApplicationMenu(buildMenuBar()) mainWindow = createWindow(); app.on('activate', function () { @@ -200,6 +200,7 @@ function buildContextMenu(args: any = {}) { } function buildMenuBar() { + const name = app.getName(); return Menu.buildFromTemplate([ { label: ' ', @@ -208,6 +209,20 @@ function buildMenuBar() { mainWindow.reload(); }, }, + ...(process.platform === 'darwin' && [{ + label: name, + submenu: Menu.buildFromTemplate([ + { + label: 'About ' + name, + role: 'about' + }, + { + label: 'Quit', + accelerator: 'Command+Q', + click() { app.quit(); } + }, + ]) + }]), { label: 'help', submenu: Menu.buildFromTemplate([