Aim: To get native Menu Bar , like most of the electron apps have.
Current Output : No error in console, but not getting any Menu in browserwindow.
Steps: In file Polyonic/src/app.js ( Changes in code can be VIEWED HERE )
1) Added const Menu = electron.Menu after line const electron = require('electron')
2) Added a sample MenuItem let template = [{ label: 'Edit', submenu: [{ label: 'Undo', accelerator: 'CmdOrCtrl+Z', role: 'undo' }, { label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo' }, { type: 'separator' }, { label: 'Cut', accelerator: 'CmdOrCtrl+X', role: 'cut' }, { label: 'Copy', accelerator: 'CmdOrCtrl+C', role: 'copy' }, { label: 'Paste', accelerator: 'CmdOrCtrl+V', role: 'paste' }, { label: 'Select All', accelerator: 'CmdOrCtrl+A', role: 'selectall' }] }];
3) In app.on-ready hook (around Line 76).... added const menu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(menu)
Aim: To get native Menu Bar , like most of the electron apps have. Current Output : No error in console, but not getting any Menu in browserwindow. Steps: In file
Polyonic/src/app.js
( Changes in code can be VIEWED HERE ) 1) Addedconst Menu = electron.Menu
after lineconst electron = require('electron')
2) Added a sample MenuItemlet template = [{ label: 'Edit', submenu: [{ label: 'Undo', accelerator: 'CmdOrCtrl+Z', role: 'undo' }, { label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo' }, { type: 'separator' }, { label: 'Cut', accelerator: 'CmdOrCtrl+X', role: 'cut' }, { label: 'Copy', accelerator: 'CmdOrCtrl+C', role: 'copy' }, { label: 'Paste', accelerator: 'CmdOrCtrl+V', role: 'paste' }, { label: 'Select All', accelerator: 'CmdOrCtrl+A', role: 'selectall' }] }];
3) In app.on-ready hook (around Line 76).... addedconst menu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(menu)
Copy of my
Polyonic/src/app.js
can be found HERE