Documentation
¶
Index ¶
- func AddMenuItem(parent, item *MenuItem)
- func AddMenuItemBefore(parent, item *MenuItem, next *MenuItem)
- func Events() <-chan *MenuItem
- func Quit()
- func Register(onReady func(), onExit func())
- func Run(onReady func(), onExit func())
- func SetIcon(iconBytes []byte)
- func SetTitle(title string)
- type Action
- type MenuItem
- func (item *MenuItem) Action() Action
- func (item *MenuItem) Children() []*MenuItem
- func (item *MenuItem) RemoveAllItems()
- func (item *MenuItem) SetAction(action Action)
- func (item *MenuItem) SetChecked(checked bool)
- func (item *MenuItem) SetDisabled(disabled bool)
- func (item *MenuItem) SetHidden(hidden bool)
- func (item *MenuItem) SetTitle(title string)
- func (item *MenuItem) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMenuItem ¶
func AddMenuItem(parent, item *MenuItem)
AddMenuItem appends the item to the parent menu list.
func AddMenuItemBefore ¶
AddMenuItemBefore adds the item to the parent menu list before the specified next item.
func Register ¶
func Register(onReady func(), onExit func())
Register initializes GUI and registers the callbacks but relies on the caller to run the event loop somewhere else. It's useful if the program needs to show other UI elements, for example, webview. To overcome some OS weirdness, On macOS versions before Catalina, calling this does exactly the same as Run().
func Run ¶
func Run(onReady func(), onExit func())
Run initializes GUI and starts the event loop, then invokes the onReady callback. It blocks until systray.Quit() is called.
Types ¶
type MenuItem ¶
type MenuItem struct {
// contains filtered or unexported fields
}
MenuItem is used to keep track each menu item of systray. Don't create it directly, use the one systray.AddMenuItem() returned
func NewMenuItem ¶
NewMenuItem returns a MenuItem object with the specified title.
func (*MenuItem) RemoveAllItems ¶
func (item *MenuItem) RemoveAllItems()
func (*MenuItem) SetChecked ¶
SetChecked sets the checked status of the current menu item.
func (*MenuItem) SetDisabled ¶
SetDisabled sets enable status of the current menu item.