go-toast

Send toast notifications in Windows
Log | Files | Refs | README | LICENSE

commit 86a0d746142079efd945bb785677821586117647
parent 7388b443a90df3175ba5eb268d1777fc93f7bf85
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Mon,  7 Oct 2024 15:36:58 +1000

toast.Notification.Push: do not auto-call SetAppData

Require the caller to set the app data. We want to avoid overwritting
things. The convenience we were trying to provide present subtle error
modes.

Diffstat:
Mtoast.go | 10+---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/toast.go b/toast.go @@ -13,7 +13,6 @@ package toast import ( "bytes" - "fmt" "git.sr.ht/~jackmordaunt/go-toast/tmpl" "git.sr.ht/~jackmordaunt/go-toast/wintoast" @@ -159,6 +158,7 @@ type Action struct { } // Push the notification to the Windows Runtime via the COM API. +// Ensure [SetAppData] has been called prior to pushing notifications. // // notification := toast.Notification{ // AppID: "Example App", @@ -180,14 +180,6 @@ func (n *Notification) Push() error { if err != nil { return err } - if err := SetAppData(wintoast.AppData{ - AppID: n.AppID, - IconPath: n.Icon, - IconBackgroundColor: n.IconBackgroundColor, - ActivationExe: n.ActivationExe, - }); err != nil { - return fmt.Errorf("configuring registry: %w", err) - } return wintoast.Push(n.AppID, xml, wintoast.PowershellFallback) }