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() {

}
