How can you make sure that the menu bar stays active when a BrowserWindow
in Electron is visible?
Case Explanation: Once you click on my Tray
icon, a BrowserWindow
is opened with some HTML. Once the cursor moves down from the Mac menu bar, the menu bar is hidden, but the BrowserWindow
is still visible.
Desired Case: Ideally, the Mac menu bar remains visible until the BrowserWindow
is de-focused and hidden.
Here is an image of how the problem looks:
Interestingly, when I create a context menu instead of having a custom BrowserWindow
...
const contextMenu = Menu.buildFromTemplate([
{ label: 'Item1', type: 'radio' },
{ label: 'Item2', type: 'radio' },
{ label: 'Item3', type: 'radio', checked: true },
{ label: 'Item4', type: 'radio' }
])
tray.setContextMenu(contextMenu)
... the Mac menu bar remains. See this image: