puretray is a port of getlantern/systray implemented with ebitengine/purego, without using cgo.
- Supported on macOS(Darwin) only (Windows and Linux are not supported yet)
- Menu items can be checked and/or disabled
- Most functions may be called from any goroutine
purego API is almost the same as getlantern/systray. Please refer to the original documentation.
func main() {
puretray.Run(onReady, onExit)
}
func onReady() {
puretray.SetIcon(icon)
puretray.SetTitle("Awesome App in Pure Go")
puretray.SetTooltip("Pretty awesome超级棒")
mQuit := puretray.AddMenuItem("Quit", "Quit the whole app")
// Sets the icon of a menu item. Only available on Mac and Windows.
mQuit.SetIcon(icon)
}
func onExit() {
// clean up here
}