Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e565300

Browse files
authoredNov 20, 2023
Enhance traybar icons (#857)
* add new icons (with border and filled), remove macos for light theme * remove dark mode detection (it was not working) * remove build tag and use file suffix for conditional build * Use `SetIconTemplate`, this allows theme switching on macos * partially revert 0444f2a Macos needs transparent icon to apply templating * rework icons: macos icons have been re-exported (to the correct size/color/opacity) windows icons have been re-exported from the linux ones (with the border) added also two svg files that should allow working on the icon easier in the future
1 parent 13515f7 commit e565300

15 files changed

+151
-58
lines changed
 

‎icon/icon.svg

Lines changed: 63 additions & 0 deletions
Loading

‎icon/icon_darwin.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package icon
2+
3+
import _ "embed" // import embed to embed the icon
4+
5+
// GetIcon will return the icon
6+
func GetIcon() []byte {
7+
return data
8+
}
9+
10+
// GetIconHiber will return the hibernated icon
11+
func GetIconHiber() []byte {
12+
return dataHibernate
13+
}
14+
15+
// data represents the icon
16+
//
17+
//go:embed icon_mac.png
18+
var data []byte
19+
20+
// dataHibernate represents the icon hibernated
21+
//
22+
//go:embed icon_mac_hiber.png
23+
var dataHibernate []byte

‎icon/icon_hiber.svg

Lines changed: 63 additions & 0 deletions
Loading

‎icon/iconlinux.go renamed to ‎icon/icon_linux.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build linux
2-
31
package icon
42

53
import _ "embed" // import embed to embed the icon

‎icon/icon_linux.png

997 Bytes
Loading

‎icon/icon_linux_hiber.png

2.34 KB
Loading

‎icon/icon_mac.png

215 Bytes
Loading

‎icon/icon_mac_hiber.png

131 Bytes
Loading

‎icon/icon_mac_light.png

-641 Bytes
Binary file not shown.

‎icon/icon_mac_light_hiber.png

-905 Bytes
Binary file not shown.

‎icon/icon_win.ico

97.2 KB
Binary file not shown.

‎icon/icon_win_hiber.ico

98.5 KB
Binary file not shown.

‎icon/iconwin.go renamed to ‎icon/icon_windows.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build windows
2-
31
package icon
42

53
import _ "embed" // import embed to embed the icon

‎icon/icondarwin.go

Lines changed: 0 additions & 52 deletions
This file was deleted.

‎systray/systray_real.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (s *Systray) Quit() {
5050

5151
// start creates a systray icon with menu options to go to arduino create, open debug, pause/quit the agent
5252
func (s *Systray) start() {
53-
systray.SetIcon(icon.GetIcon())
53+
systray.SetTemplateIcon(icon.GetIcon(), icon.GetIcon())
5454

5555
// Add version
5656
menuVer := systray.AddMenuItem("Agent version "+s.Version, "")
@@ -136,7 +136,7 @@ func RemoveCrashes() {
136136

137137
// starthibernate creates a systray icon with menu options to resume/quit the agent
138138
func (s *Systray) startHibernate() {
139-
systray.SetIcon(icon.GetIconHiber())
139+
systray.SetTemplateIcon(icon.GetIconHiber(), icon.GetIconHiber())
140140

141141
mResume := systray.AddMenuItem("Resume Agent", "")
142142
systray.AddSeparator()

0 commit comments

Comments
 (0)
Please sign in to comment.