go-nativenotify

Native notifications in Go
Log | Files | Refs | README | LICENSE

commit 3cf47c0bc6cd2182e726e323b42fdd7fd9bd460f
parent 92851c6c56341553f7e6efe26d6f85136b7ce679
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Fri, 17 Jan 2025 16:14:03 +0800

notify: [windows] add windows-specific options

Allows cropping and hero icons.

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

Diffstat:
Mnotify.go | 11+++++++++++
Mnotify_windows.go | 9+++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/notify.go b/notify.go @@ -48,8 +48,19 @@ type Notification struct { // ButtonActions are for getting button input from the user. ButtonActions []ButtonAction + + // Windows defines windows specific options. + Windows WindowsOption } +type WindowsOption int + +const ( + WindowsOptionIconSquareCrop WindowsOption = iota + WindowsOptionIconCircleCrop + WindowsOptionIconHero +) + // TextAction describes a text input. // It might have an associated button. // The user input text is passed to the callback on activation. diff --git a/notify_windows.go b/notify_windows.go @@ -86,6 +86,15 @@ func push(n Notification) (err error) { Inputs: inputs, } + switch n.Windows { + case WindowsOptionIconCircleCrop: + tn.IconCrop = windowsnotify.CropStyleCircle + case WindowsOptionIconSquareCrop: + tn.IconCrop = windowsnotify.CropStyleSquare + case WindowsOptionIconHero: + tn.HeroIcon, tn.Icon = tn.Icon, "" + } + callbacksPut(&callbacks, strconv.FormatInt(id, 10), n.Callback) return tn.Push()