asticode / go-astilectron-bootstrap

Create a one-window application using Astilectron

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to bootstrap without menus

chinenual opened this issue · comments

My app needs a menu on MacOS, but I wish to have no menu on Windows. I am having trouble figuring out how to configure the bootstrap MenuOptions to affect this.
My reading of the sources suggests that just passing an empty array of options should do, but when I do that, the app crashes on startup:

2020/05/02 17:48:54 logger.go:67: Stdout says: 
2020/05/02 17:48:54 logger.go:66: App has crashed
2020/05/02 17:48:54 logger.go:66: Stopping...
2020/05/02 17:48:54 logger.go:78: astikit: stopping worker...
2020/05/02 17:48:54 logger.go:66: Closing...

I've tried a variety of approaches. If I pass the menu in as a variable initialized to default value, it crashes on both Mac and Windows:

var menuOptions = []*astilectron.MenuItemOptions

if I explicity initialize to a zero lenght array, it also crashes on both platforms:

var menuOptions = []*astilectron.MenuItemOptions{}

if I comment out the MenuOptions: label and value in the bootstrap options, the mac app runs (without a menu), but the windows app still crashes.

...
		Debug:  *debug,
		Logger: l,
		// MenuOptions: menuOptions,
...

Ideas?

This was user error. On Windows, I had a stray electron process left over from a previous crash. Once I cleaned that up, initializing the menu option as

var menuOptions = []*astilectron.MenuItemOptions{}

worked as expected!