Electron-packager: Menu bar automatically removed?

Created on 11 Sep 2015  路  7Comments  路  Source: electron/electron-packager

It seems the BrowserWindow menu bar is automatically removed by the packager. Please see attached screenshots.

electron
electron

electron-packager
electron-packager

I couldn't find anything in the docs about this.

Help?

question

Most helpful comment

Assuming you are referring to the default menu bar, this sounds similar to an issue I have seen a couple of people ask in #atom-shell, and it's more a result of packaging your app and running it directly, than of electron-packager specifically (it just happens to be a tool that facilitates that).

When you run your app in development, you are probably running electron my-app-dir. This ends up running Electron's default app, then loading your app _through_ that. The default app is what sets up that menu. When you package your app, you are going to be running your app _directly_, not through the default app, so no menu.

If you have a specific use for menus, I would generally expect that you'd be configuring your own menu within your app anyway, in which case this issue should become moot.

All 7 comments

Crazy! I have no idea personally, someone else might

I wonder if this happens on Linux...

(Obviously, it wouldn't happen on OSX because of the fixed menu bar.)

I should have mentioned it is the default menu bar, not a custom menu bar. Could it be that the packager detects that and automatically disables it, assuming non-debug mode?

I'm pretty confident this wouldn't be any code in electron-packager, the only difference would be how the process is spawned. It's possible that it's spawned somehow differently from the CLI as opposed to when you run it from an EXE, but I'm not sure how to go about debugging that.

Assuming you are referring to the default menu bar, this sounds similar to an issue I have seen a couple of people ask in #atom-shell, and it's more a result of packaging your app and running it directly, than of electron-packager specifically (it just happens to be a tool that facilitates that).

When you run your app in development, you are probably running electron my-app-dir. This ends up running Electron's default app, then loading your app _through_ that. The default app is what sets up that menu. When you package your app, you are going to be running your app _directly_, not through the default app, so no menu.

If you have a specific use for menus, I would generally expect that you'd be configuring your own menu within your app anyway, in which case this issue should become moot.

Ahh thanks for the insight @kfranqueiro, that makes sense. I wonder if the best solution would be to ask Electron to disable that menu in the default app, that way it won't set the false expectation

@kfranqueiro, thanks for the breakdown. It still seems quite unexpected, and not well documented. I'll close this issue.

Was this page helpful?
0 / 5 - 0 ratings