asticode / go-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)
MIT License
4.9k stars 344 forks source link

Remove menu area? #278

Closed hkdb closed 4 years ago

hkdb commented 4 years ago

Is there a proper go-astilectron bootstrap options way to remove the menu area all together? I don't plan on having any menus at all in my app.

Thanks!

asticode commented 4 years ago

Normally, the default menu is removed. What do you mean by menu area ?

hkdb commented 4 years ago

Screenshot from 2020-09-28 16-17-46

Here's my code for the bootstrap part:

    // Run bootstrap
    l.Printf("Running app built at %s\n", BuiltAt)
    if err := bootstrap.Run(bootstrap.Options{
        Asset:    Asset,
        AssetDir: AssetDir,
        AstilectronOptions: astilectron.Options{
            AppName:            "Super App",
            AppIconDarwinPath:  "resources/icon.icns",
            AppIconDefaultPath: "resources/logo.png",
            SingleInstance:     true,
        },
        Debug:         true, //*debug,
        Logger:        l,
        RestoreAssets: RestoreAssets,
        Windows: []*bootstrap.Window{{
            Homepage:       "index.html",
            MessageHandler: handleMessages,
            Options: &astilectron.WindowOptions{
                BackgroundColor: astikit.StrPtr("#333"),
                Center:          astikit.BoolPtr(true),
                Height:          astikit.IntPtr(windowHeight),
                Width:           astikit.IntPtr(windowWidth),
            },
        }},
    }); err != nil {
        l.Fatal(fmt.Errorf("running bootstrap failed: %w", err))
    }

I didn't specify a menu at all and I am getting the blank menu area marked in red as per the screenshot above the code snippet.

Thanks!

asticode commented 4 years ago

Are you testing on MacOSX ? If so, which version are you using ?

hkdb commented 4 years ago

I am on Pop! OS 20.04 but the final product is targeted to run on Windows, MacOS, and Linux. Thanks!

asticode commented 4 years ago

Setting Debug to true creates a menu. Could you try with Debug set to false ?

hkdb commented 4 years ago

Ahhhh I see! menu area is gone as soon as I set the debug to false. Thank you!

asticode commented 4 years ago

Cheers

hkdb commented 4 years ago

Sorry to keep pestering you about this and I really appreciate your help but I just noticed that while in Linux, I am able to paste just fine, in MacOS, it doesn't work. So I found this:

https://github.com/asticode/go-astilectron/issues/68

But doesn't that mean that I have to build a menu item and have a menu just so I can have copy and paste?

Thanks!

asticode commented 4 years ago

Unfortunately yes, you need to set menu items with proper shortcuts in order to copy/paste

hkdb commented 4 years ago

Looks like as long as I set an empty label on the menu item, the menu area doesn't show up in mac. So I guess my solution for now is to have the build script comment out that menuOptions block for the Linux build and un-comment the block for the Mac build. A dirty hack but will certainly accomplish what I need. Off to Windows testing!

Thanks again for your help!