wails-app-dock/pkg/systray/systray.go
2024-05-12 18:29:00 +08:00

41 lines
653 B
Go

package systray
import (
"fmt"
"github.com/energye/systray"
"github.com/energye/systray/icon"
)
var DefaultIcon = icon.Data
func Init(init func()) {
systray.Run(func() {
systray.SetIcon(icon.Data)
systray.SetTitle("wails-app-dock")
systray.SetOnClick(func(menu systray.IMenu) {
fmt.Println("SetOnClick")
})
systray.SetOnDClick(func(menu systray.IMenu) {
fmt.Println("SetOnDClick")
})
systray.SetOnRClick(func(menu systray.IMenu) {
fmt.Println("SetOnRClick")
err := menu.ShowMenu()
if err != nil {
fmt.Println(err.Error())
return
}
})
if init != nil {
init()
}
}, onExit)
}
func onExit() {
}