-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtray.go
44 lines (37 loc) · 965 Bytes
/
tray.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
package main
import (
"github.com/getlantern/systray"
"github.com/skratchdot/open-golang/open"
)
var StatusTrayButtonShowHide = false
var TrayButtonShowHide *systray.MenuItem
func Tray() {
systray.SetTemplateIcon(Icon, Icon)
systray.SetTitle(AppName)
systray.SetTooltip(AppName)
systray.AddMenuItem(AppName+" v"+AppVersion, "Version").Disable()
systray.AddSeparator()
TrayButtonShowHide = systray.AddMenuItem("Hide Window", "Hides Window")
go func() {
for {
<-TrayButtonShowHide.ClickedCh
if !StatusTrayButtonShowHide {
GUIch <- "windowHide"
} else if StatusTrayButtonShowHide {
GUIch <- "windowShow"
}
}
}()
trayButtonProjectPage := systray.AddMenuItem("Open Project Page", "Opens project page")
go func() {
for {
<-trayButtonProjectPage.ClickedCh
open.Run(AppProjectPage)
}
}()
trayButtonQuit := systray.AddMenuItem("Quit", "Quits the app")
go func() {
<-trayButtonQuit.ClickedCh
GUIch <- "quit"
}()
}