electron-window-manager
electron-window-manager copied to clipboard
Invalid Menu on Linux
I am trying to create a new menu for a new window. Tried the fix from #47, did not work If I remove the menu from the new window (not main window) then it works and I see the menu from the Main window in the new window.
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')
In the main window I am using Menu to set the menu
app.on('ready', () => { const menu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(menu) })
If I remove this and try to set this from the template 'menu': it fails in the same way when opening the main window.
in tempalte.set 'main': template
let template = [{ label: '3DXTech', submenu: [{ label: 'Load EEPROM FIle', accelerator: 'CmdOrCtrl-L', click() { load_eeprom() } }, { label: 'Save EEPROM File', accelerator: 'CmdOrCtrl-S', click() { save_eeprom() } }, { label: "Quit", accelerator: 'Command-Q', role: 'quit' }, ] }, { label: 'Debug', submenu:[{ label: 'Toggle Development Tools', accelerator: 'CmdOrCtrl-D', click: (item, focusedWindow) => { if (focusedWindow) { focusedWindow.toggleDevTools() } } }] }]
Got it to kinda work with Menu.buildFromTemplate(template)
But it changes both the main window and the new window..
What is the process for a new window to have it's own menu.