Open GitFlip opened 7 years ago
The issue is that electron-window-manager
passes your menu to the browser window using setMenu
. This allows you to set different menus to different windows but it is only available on Windows and Linux.
An immediate fix is to set the menu directly yourself, using something like:
const { Menu } = require('electron')
var thisWindow = winManager.createNew(win, 'Window', index.html`, win)
var template = [ ... ] // Standard electron menu setup
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
Hope that helps.
Edit: See #60 for a possible fix.
Am having the same issue on Linux: I am trying to create a new menu for a new window.
Tried the fix above but it did not work.
error-utils.ts:14 Uncaught Error: Could not call remote method 'open'. Check that the method signature is correct. Underlying error: Invalid Menu Underlying stack: TypeError: Invalid Menu
windowManager.templates.set('read', {
'width': 800,
'height': 600,
'position': 'topLeft',
'showDevTools': false,
'resizable': true,
'title': 'Load',
'menu': {
label: 'Read',
submenu: [
{ role: 'quit' }
]
},
'webPreferences': {
// preload: path.join(__dirname, 'preload.js'),
'nodeIntegration': true
},
readwin = windowManager.createNew('readwin', 'Read eeprom', path.join('file://', __dirname, '/read.html'), 'read')
I cannot seem to create a new menu. I'm getting this error:
The Test App will work if I remove the menu...
Code: