go-toast

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

commit df90b957fc5b334eaa97ee2c3e1f2dbd89f528d0
parent e536997593cdb83b30d37626605340d65dd42939
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Thu,  7 Dec 2023 12:32:30 +0800

toast: synchronize AppData

Keep AppData in sync between the front and backend.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>

Diffstat:
Mtoast.go | 24+++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/toast.go b/toast.go @@ -164,7 +164,7 @@ func (n *Notification) Push() error { if err != nil { return err } - if err := wintoast.SetAppData(wintoast.AppData{ + if err := SetAppData(wintoast.AppData{ AppID: n.AppID, IconPath: n.Icon, IconBackgroundColor: n.IconBackgroundColor, @@ -215,29 +215,11 @@ func SetActivationCallback(cb func(args string, data []UserData)) { }) } -// AppData describes the various application metadata that can be used with Windows -// toast notifications. -type AppData struct { - // AppID of the application. This should be a pretty name as it will be displayed in - // the notification. - AppID string - - // ActivationExe is the full path to an executable that Windows will invoke when - // the application is not running. This can be used to cold-start the application. - // Windows will provide an extra flag, so the named executable must be able to handle extra flags. - ActivationExe string // optional - - // IconPath is the full path to an icon that Windows will display for the notification. - IconPath string // optional - - // IconBackgroundColor is a hex encoded color code that Windows will display as the background - // for the named icon. - IconBackgroundColor string // optional -} +type AppData = wintoast.AppData // SetAppData sets application metadata in the Windows Registry. // This is required to display the application name, as well as any branding. // Registry is global state, hence it makes sense to set it global. func SetAppData(data AppData) error { - return wintoast.SetAppData(wintoast.AppData(data)) + return wintoast.SetAppData(data) }