Register Windows notification icon via metadata after NewWindow.
Fyne toasts read App.Icon without SetIcon, preserving the PE multi-size window and taskbar icon while giving failure notifications app artwork. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,6 +59,7 @@ func Run(startInTray bool) {
|
||||
}
|
||||
|
||||
w := a.NewWindow("GoSentry " + app.Version)
|
||||
setWindowsNotificationIcon()
|
||||
prefs := a.Preferences()
|
||||
winW := float32(prefs.FloatWithFallback("window.width", defaultWindowWidth))
|
||||
winH := float32(prefs.FloatWithFallback("window.height", defaultWindowHeight))
|
||||
@@ -94,3 +95,20 @@ func Run(startInTray bool) {
|
||||
recordStartup(time.Since(started), true)
|
||||
a.Run()
|
||||
}
|
||||
|
||||
// setWindowsNotificationIcon supplies App.Icon for Fyne desktop notifications
|
||||
// without touching the window or taskbar icon. On Windows those come from the PE
|
||||
// gosentry.ico resource, so run.go must not call SetIcon. Fyne's NewWindow ends
|
||||
// with SetIcon(nil), which adopts App.Icon when it is already set — metadata
|
||||
// must therefore be registered only after the window is created. The tray icon
|
||||
// is set separately in tray.go via SetSystemTrayIcon.
|
||||
func setWindowsNotificationIcon() {
|
||||
if runtime.GOOS != "windows" {
|
||||
return
|
||||
}
|
||||
fyneapp.SetMetadata(fyne.AppMetadata{
|
||||
ID: appID,
|
||||
Name: "GoSentry",
|
||||
Icon: assets.Icon(),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user