AlexTorresDev / custom-electron-titlebar

Custom electon title bar inpire on VS Code title bar
MIT License
866 stars 148 forks source link

Use getMenu instead of getApplicationMenu #242

Open Christilut opened 1 year ago

Christilut commented 1 year ago

Problem Description

Code uses Menu.getApplicationMenu() but should use mainWindow.getMenu()

    ipcMain.handle('request-application-menu', async () => JSON.parse(JSON.stringify(
        Menu.getApplicationMenu(),
        (key: string, value: any) => (key !== 'commandsMap' && key !== 'menu') ? value : undefined)
    ))

Expected Behavior

When setting a menu with mainWindow.setMenu(), this package no longer finds the menu items. So my code has to use Menu.setApplicationMenu() for this package to work. The problem is that this sets the same menu to all windows, including the dev tools.

This is probably a big source for this package not working for other users since there is no feedback at all why the menu is empty.

    "electron": "25.8.2",
    "custom-electron-titlebar": "^4.2.7",