wintoast

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2024 License: MIT, Unlicense Imports: 1 Imported by: 0

Documentation

Overview

Package wintoast provides a pure-Go implementation of toast notifications on Windows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PowershellFallback

func PowershellFallback(opt *options)

PowershellFallback specifies to use the powershell method as a fallback if the COM api fails.

func PreferPowershell

func PreferPowershell(opt *options)

PreferPowershell indicates to use the powershell method by default. COM will not be used.

func Push

func Push(xml string, op ...option) error

Push a notification described by the XML to the Windows Runtime.

App data should be set first via a call to SetAppData before calling this function.

If the powershell fallback is engaged, activation callbacks will not work as expected and the COM error will still be returned.

func SetActivationCallback

func SetActivationCallback(cb Callback)

SetActivationCallback establishes the callback `cb` to be invoked when the toast notification is activated. This callback instance should handle being activated from any available toast notification.

func SetAppData

func SetAppData(data AppData) (err error)

SetAppData teaches the Windows Runtime about our application and establishes the activation GUID so Windows will know how to invoke us back.

Types

type AppData

type AppData struct {
	AppID               string
	GUID                string
	ActivationExe       string // optional
	IconPath            string // optional
	IconBackgroundColor string // optional
}

AppData describes the application to the Windows Runtime. See toast.Notification for more thorough documentation off these fields.

type Callback

type Callback func(appUserModelId string, invokedArgs string, userData []UserData)

Callback is a function that gets invoked when the notification is activated.

type UserData

type UserData struct {
	Key   string
	Value string
}

UserData contains Key:Value pairs generated within the notification, based on the XML content of the notification. Specifically, all inputs within the XML will generate a corresponding UserData struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL