diff --git a/icon/icon.svg b/icon/icon.svg new file mode 100644 index 000000000..8bc6f5fb2 --- /dev/null +++ b/icon/icon.svg @@ -0,0 +1,63 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/icon/icon_darwin.go b/icon/icon_darwin.go new file mode 100644 index 000000000..dfdfa34a7 --- /dev/null +++ b/icon/icon_darwin.go @@ -0,0 +1,23 @@ +package icon + +import _ "embed" // import embed to embed the icon + +// GetIcon will return the icon +func GetIcon() []byte { + return data +} + +// GetIconHiber will return the hibernated icon +func GetIconHiber() []byte { + return dataHibernate +} + +// data represents the icon +// +//go:embed icon_mac.png +var data []byte + +// dataHibernate represents the icon hibernated +// +//go:embed icon_mac_hiber.png +var dataHibernate []byte diff --git a/icon/icon_hiber.svg b/icon/icon_hiber.svg new file mode 100644 index 000000000..91021711e --- /dev/null +++ b/icon/icon_hiber.svg @@ -0,0 +1,63 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/icon/iconlinux.go b/icon/icon_linux.go similarity index 95% rename from icon/iconlinux.go rename to icon/icon_linux.go index 0a09a3e9e..b00f743aa 100644 --- a/icon/iconlinux.go +++ b/icon/icon_linux.go @@ -1,5 +1,3 @@ -//go:build linux - package icon import _ "embed" // import embed to embed the icon diff --git a/icon/icon_linux.png b/icon/icon_linux.png index c282ea137..b32940840 100644 Binary files a/icon/icon_linux.png and b/icon/icon_linux.png differ diff --git a/icon/icon_linux_hiber.png b/icon/icon_linux_hiber.png index 7a4078fcb..5995ce96a 100644 Binary files a/icon/icon_linux_hiber.png and b/icon/icon_linux_hiber.png differ diff --git a/icon/icon_mac.png b/icon/icon_mac.png index 0f6605b33..24dd8ae1b 100644 Binary files a/icon/icon_mac.png and b/icon/icon_mac.png differ diff --git a/icon/icon_mac_hiber.png b/icon/icon_mac_hiber.png index dcd47edb3..b57292690 100644 Binary files a/icon/icon_mac_hiber.png and b/icon/icon_mac_hiber.png differ diff --git a/icon/icon_mac_light.png b/icon/icon_mac_light.png deleted file mode 100644 index 9cc820e02..000000000 Binary files a/icon/icon_mac_light.png and /dev/null differ diff --git a/icon/icon_mac_light_hiber.png b/icon/icon_mac_light_hiber.png deleted file mode 100644 index 4280fd333..000000000 Binary files a/icon/icon_mac_light_hiber.png and /dev/null differ diff --git a/icon/icon_win.ico b/icon/icon_win.ico index f62cfde83..de577ec75 100644 Binary files a/icon/icon_win.ico and b/icon/icon_win.ico differ diff --git a/icon/icon_win_hiber.ico b/icon/icon_win_hiber.ico index 031a4c224..652370e13 100644 Binary files a/icon/icon_win_hiber.ico and b/icon/icon_win_hiber.ico differ diff --git a/icon/iconwin.go b/icon/icon_windows.go similarity index 95% rename from icon/iconwin.go rename to icon/icon_windows.go index 1225ba03b..2cf75b5e3 100644 --- a/icon/iconwin.go +++ b/icon/icon_windows.go @@ -1,5 +1,3 @@ -//go:build windows - package icon import _ "embed" // import embed to embed the icon diff --git a/icon/icondarwin.go b/icon/icondarwin.go deleted file mode 100644 index a53dfcdf0..000000000 --- a/icon/icondarwin.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build darwin - -package icon - -import ( - _ "embed" // import embed to embed the icon - "os/exec" - "strings" -) - -// isDarkMode will return if the system is in darkmode -func isDarkMode() bool { - cmd := exec.Command("defaults", "read", "-g", "AppleInterfaceStyle") - output, _ := cmd.Output() - return strings.Contains(string(output), "Dark") -} - -// GetIcon will return the icon -func GetIcon() []byte { - if isDarkMode() { - return data - } - return dataLight -} - -// GetIconHiber will return the hibernated icon -func GetIconHiber() []byte { - if isDarkMode() { - return dataDarkHibernate - } - return dataLightHibernate -} - -// dataLight represents the icon -// -//go:embed icon_mac_light.png -var dataLight []byte - -// dataLightHibernate represents the light icon hibernated -// -//go:embed icon_mac_light_hiber.png -var dataLightHibernate []byte - -// data represents the icon -// -//go:embed icon_mac.png -var data []byte - -// dataDarkHibernate represents the dark icon hibernated -// -//go:embed icon_mac_hiber.png -var dataDarkHibernate []byte diff --git a/systray/systray_real.go b/systray/systray_real.go index 20db97118..1c94c7ab1 100644 --- a/systray/systray_real.go +++ b/systray/systray_real.go @@ -50,7 +50,7 @@ func (s *Systray) Quit() { // start creates a systray icon with menu options to go to arduino create, open debug, pause/quit the agent func (s *Systray) start() { - systray.SetIcon(icon.GetIcon()) + systray.SetTemplateIcon(icon.GetIcon(), icon.GetIcon()) // Add version menuVer := systray.AddMenuItem("Agent version "+s.Version, "") @@ -136,7 +136,7 @@ func RemoveCrashes() { // starthibernate creates a systray icon with menu options to resume/quit the agent func (s *Systray) startHibernate() { - systray.SetIcon(icon.GetIconHiber()) + systray.SetTemplateIcon(icon.GetIconHiber(), icon.GetIconHiber()) mResume := systray.AddMenuItem("Resume Agent", "") systray.AddSeparator()