asticode / go-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use tray?

heary29 opened this issue · comments

Hello, I am trying to use go-astilectron project to make a gui program, I need to have a tray function, but I did not get how to deal with the tray mouse click, right click and other events when viewing the source code, just like the maximization or minimization of the window, the tray.go file only contains create, destroy, set the picture, please what should I do next to help my needs?

Tray inherits the On method which you can use to react to tray's events.

For instance:

var t *astilectron.Tray
t.On(astilectron.EventNameTrayEventClicked, func(e astilectron.Event) (deleteListener bool) {
  log.Println("tray has been clicked!")
  return true
})

Okay, thank you very much!