-
Notifications
You must be signed in to change notification settings - Fork 0
/
systray.go
46 lines (40 loc) · 939 Bytes
/
systray.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"fmt"
"github.com/energye/systray"
"github.com/energye/systray/icon"
"time"
)
func runSystray() {
systray.Run(onReady, onExit)
}
func onExit() {
}
func updateSystray() {
systray.SetIcon(scienceTinyFlashIcon)
go func() {
time.Sleep(500 * time.Millisecond)
systray.SetIcon(scienceTinyIcon)
}()
systray.SetTooltip(fmt.Sprintf("Last Moved: %s\nMove count: %v", lastMoved, counter))
}
func onReady() {
systray.SetIcon(scienceTinyIcon)
systray.SetTitle("Automover")
systray.SetTooltip(fmt.Sprintf("Last Moved: %s\nMove count: %v", "none", counter))
systray.SetOnClick(func(menu systray.IMenu) {
mu.Lock()
defer mu.Unlock()
if !wndVisible {
wndVisible = true
go runGiu()
}
})
systray.SetOnDClick(func(menu systray.IMenu) {
})
systray.SetOnRClick(func(menu systray.IMenu) {
menu.ShowMenu()
})
mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
mQuit.SetIcon(icon.Data)
}