uofgcal/tray/tray.go

37 lines
600 B
Go

package tray
import (
_ "embed"
"git.newty.dev/uofgsync/fetch"
"github.com/charmbracelet/log"
"github.com/getlantern/systray"
)
//go:embed uofg.ico
var icon []byte
func OnReady() {
systray.SetTitle("UofG Sync") // mac+linux
systray.SetTooltip("UofG Sync")
systray.SetIcon(icon)
// todo: last synced
// todo: force sync
// todo: pause sync
// todo: options
// quit button
quit := systray.AddMenuItem("Quit", "Quit the application")
go func() {
<-quit.ClickedCh
systray.Quit()
}()
}
func OnExit() {
err := (*fetch.Scheduler).Shutdown()
if err != nil {
log.Fatal(err)
}
}