AlexTorresDev / custom-electron-titlebar

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

fix menuItem roles #150

Closed Araxeus closed 3 years ago

Araxeus commented 3 years ago

Last fix in #148 worked, but it can be fixed in a much better way

The original error came from the fact that Electron.MenuItem.click() was called with the wrong parameters: (those are parameters that the user registered callback for click should receive, but electron takes care of that)

https://github.com/AlexTorresSk/custom-electron-titlebar/blob/8901746f905682f89b0b58378e845fd053437009/src/menu/menuitem.ts#L141

The right parameters for MenuItem.click are:

this.click = (event: Event, focusedWindow: BrowserWindow, focusedWebContents: WebContents) => {

As defined in Electron.MenuItem