This commit is contained in:
@@ -13,9 +13,15 @@ const defaultDocumentRoot string = "C:\\ProgramData\\CloudSave"
|
||||
//go:embed res/icon.ico
|
||||
var icon []byte
|
||||
|
||||
var (
|
||||
updateChan chan struct{}
|
||||
)
|
||||
|
||||
func main() {
|
||||
updateChan = make(chan struct{})
|
||||
go systray.Run(onReady, onExit)
|
||||
run()
|
||||
|
||||
run(updateChan)
|
||||
}
|
||||
|
||||
func fatal(message string, exitCode int) {
|
||||
@@ -28,12 +34,20 @@ func onReady() {
|
||||
systray.SetTooltip("CloudSave")
|
||||
systray.SetIcon(icon)
|
||||
|
||||
mQuit := systray.AddMenuItem("Quit", "Quit")
|
||||
mReload := systray.AddMenuItem("Reload", "Reload the server data")
|
||||
mQuit := systray.AddMenuItem("Quit", "Quit the server")
|
||||
|
||||
go func() {
|
||||
<-mQuit.ClickedCh
|
||||
os.Exit(0)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
for {
|
||||
<-mReload.ClickedCh
|
||||
updateChan <- struct{}{}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func onExit() {
|
||||
|
||||
Reference in New Issue
Block a user