Skip to content

Instantly share code, notes, and snippets.

@guaychou
Last active May 2, 2020 18:03
Show Gist options
  • Save guaychou/a4a6b1ab84fb57c99bb25c7d454e6b1e to your computer and use it in GitHub Desktop.
Save guaychou/a4a6b1ab84fb57c99bb25c7d454e6b1e to your computer and use it in GitHub Desktop.
func onReady(){
go func() {
var result string
var err error
for {
result,err=pingGoogle()
if err!=nil{
systray.SetTitle(err.Error())
}else{
systray.SetTitle(result)
time.Sleep(2 * time.Second)
}
}
}()
systray.AddSeparator()
mQuit := systray.AddMenuItem("Quit", "Quits this app")
go func() {
for {
select {
case <-mQuit.ClickedCh:
systray.Quit()
return
}
}
}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment