@@ -565,6 +565,28 @@ func openBrowser(url string, openBrowserWg *sync.WaitGroup) {
565565
566566func openElectron (trayIconPath * kelpos.OSPath , url string ) {
567567 log .Printf ("opening URL in electron: %s" , url )
568+ quitMenuItemOption := & astilectron.MenuItemOptions {
569+ Label : astilectron .PtrStr ("Quit" ),
570+ Visible : astilectron .PtrBool (true ),
571+ Enabled : astilectron .PtrBool (true ),
572+ OnClick : astilectron .Listener (func (e astilectron.Event ) (deleteListener bool ) {
573+ quit ()
574+ return false
575+ }),
576+ }
577+ mainMenuItemOptions := []* astilectron.MenuItemOptions {
578+ & astilectron.MenuItemOptions {
579+ Label : astilectron .PtrStr ("File" ),
580+ SubMenu : []* astilectron.MenuItemOptions {
581+ quitMenuItemOption ,
582+ },
583+ },
584+ & astilectron.MenuItemOptions {
585+ Label : astilectron .PtrStr ("Edit" ),
586+ Role : astilectron .MenuItemRoleEditMenu ,
587+ },
588+ }
589+
568590 e := bootstrap .Run (bootstrap.Options {
569591 AstilectronOptions : astilectron.Options {
570592 AppName : "Kelp" ,
@@ -585,15 +607,10 @@ func openElectron(trayIconPath *kelpos.OSPath, url string) {
585607 Image : astilectron .PtrStr (trayIconPath .Native ()),
586608 },
587609 TrayMenuOptions : []* astilectron.MenuItemOptions {
588- & astilectron.MenuItemOptions {
589- Label : astilectron .PtrStr ("Quit" ),
590- Visible : astilectron .PtrBool (true ),
591- Enabled : astilectron .PtrBool (true ),
592- OnClick : astilectron .Listener (func (e astilectron.Event ) (deleteListener bool ) {
593- quit ()
594- return false
595- }),
596- },
610+ quitMenuItemOption ,
611+ },
612+ MenuOptions : []* astilectron.MenuItemOptions {
613+ & astilectron.MenuItemOptions {SubMenu : mainMenuItemOptions },
597614 },
598615 })
599616 if e != nil {
0 commit comments