Windows 11
ehsun7b opened this issue · comments
Ehsun commented
andrewfstratton commented
You may need to set the icon - I think it was a bit tricky with windows - you should have a setup something like:
func Run() {
systray.Run(setup, close)
}
func setup() {
systray.SetIcon(icon.Data())
...
Where I have this for my icon.go that is imported:
package icon
import (
"fmt"
"io/ioutil"
"path/filepath"
)
const favicon_location = "editor/favicon.ico"
func Data() []byte {
bytes, err := ioutil.ReadFile(filepath.FromSlash(favicon_location))
if err != nil {
fmt.Println("Failed to find '", favicon_location, "'")
bytes = nil
}
return bytes
}
Hope this helps - Andy
P.S. You might also try this oldish guide - https://dev.to/osuka42/building-a-simple-system-tray-app-with-go-899 - but I think I had issues with Windows and slashes...
Seth Wright commented
I don't know that any of us have an Windows 11 box to test against, so if anyone wants to contribute the code as a PR to make it work, I'll review and commit it.