const {Menu} = require('electron'), electron = require('electron'), app = electron.app, {shell} = require('electron'); const template = [ { label: 'Edit', submenu: [ { role: 'undo' }, { role: 'redo' }, { type: 'separator' }, { role: 'cut' }, { role: 'copy' }, { role: 'paste' }, { role: 'pasteandmatchstyle' }, { role: 'delete' }, { role: 'selectall' } ] }, { label: 'View', submenu: [ { label: 'Reload', accelerator: 'CmdOrCtrl+R', click (item, focusedWindow) { if (focusedWindow) focusedWindow.reload(); } }, { label: 'Toggle Developer Tools', accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I', click (item, focusedWindow) { if (focusedWindow) focusedWindow.webContents.toggleDevTools(); } }, { type: 'separator' }, { role: 'resetzoom' }, { role: 'zoomin' }, { role: 'zoomout' }, { type: 'separator' }, { role: 'togglefullscreen' } ] }, { role: 'window', submenu: [ { role: 'minimize' }, { role: 'close' } ] }, { role: 'help', label: 'Support', submenu: [ { label: 'komodoplatform.com', click () { if (process.platform === 'linux') { require('child_process').exec('xdg-open https://www.komodoplatform.com'); } else { shell.openExternal('https://www.komodoplatform.com'); } } }, { label: 'Slack', click () { if (process.platform === 'linux') { require('child_process').exec('xdg-open https://www.komodoplatform.com/en/slack-invite'); } else { shell.openExternal('https://www.komodoplatform.com/en/slack-invite'); } } }, { label: 'Github', click () { if (process.platform === 'linux') { require('child_process').exec('xdg-open https://github.com/KomodoPlatform/BarterDEX/issues'); } else { shell.openExternal('https://github.com/KomodoPlatform/BarterDEX/issues'); } } } ] } ] if (process.platform === 'darwin') { const name = app.getName(); template.unshift({ label: name, submenu: [ { role: 'about' }, { type: 'separator' }, { role: 'services', submenu: [] }, { type: 'separator' }, { role: 'hide' }, { role: 'hideothers' }, { role: 'unhide' }, { type: 'separator' }, { label: 'Quit', accelerator: 'CmdOrCtrl+Q', role: 'close' } ] }); // Edit menu. template[1].submenu.push( { type: 'separator' }, { label: 'Speech', submenu: [ { role: 'startspeaking' }, { role: 'stopspeaking' } ] } ); // Window menu. template[3].submenu = [ { label: 'Close', accelerator: 'CmdOrCtrl+W', role: 'close' }, { label: 'Minimize', accelerator: 'CmdOrCtrl+M', role: 'minimize' }, { label: 'Zoom', role: 'zoom' }, { type: 'separator' }, { label: 'Bring All to Front', role: 'front' } ] }; const menu = Menu.buildFromTemplate(template); Menu.setApplicationMenu(menu);