Documentation ¶
Overview ¶
Package windows implements the Windows Notifications.
See https://msdn.microsoft.com/en-us/library/windows/desktop/ee330740(v=vs.85).aspx for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrGUID = errors.New("notify: invalid GUID format") ErrIcon = errors.New("notify: unknown icon type") )
Functions ¶
func NewNotifier ¶
NewNotifier returns a new Notifier.
Register supports following icon types:
- uint16
- image.Image
- IconType
- *Icon
Register accepts following keys and value types:
- windows:fallback-icon IconType This is used on Windows XP or earlier if the specified icon is *Icon.
- windows:sound bool This is ignored on Windows 2000 or earlier.
Types ¶
type BalloonEvent ¶
type BalloonEvent uint
BalloonEvent represents an event of the notification balloon.
const ( // BalloonShown represents the NIN_BALLOONSHOW message. BalloonShown BalloonEvent = iota // BalloonClosed represents the NIN_BALLOONHIDE or NIN_BALLOONTIMEOUT message. BalloonClosed // BalloonClicked represents the NIN_BALLOONUSERCLICK message. BalloonClicked )
List of events for the notification balloon.
func (BalloonEvent) String ¶
func (i BalloonEvent) String() string
type GUID ¶
type GUID string
GUID represents a textual representation of the GUID.
The following formats are supported ("x" represents a hexadecimal digit):
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
type Icon ¶
type Icon struct {
// contains filtered or unexported fields
}
Icon represents a handle of the icon.
type IconType ¶
type IconType uint8
IconType represents an icon type of the Notification.
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
Menu represents a context menu of the NotifyIcon.
type MenuEvent ¶
type MenuEvent struct {
ID uint16
}
MenuEvent represents an event of the context menu.
type Notification ¶
type Notification struct { Title string Body string IconType IconType Icon *Icon // requires Windows Vista or later Sound bool }
Notification represents a notification.
type NotifyIcon ¶
type NotifyIcon struct { Icon *Icon GUID GUID // requires Windows 7 or later Balloon chan BalloonEvent // requires Windows XP or later Menu chan MenuEvent // contains filtered or unexported fields }
NotifyIcon represents a notification icon in the notification area.
func (*NotifyIcon) Add ¶
func (ni *NotifyIcon) Add() error
Add adds the NotifyIcon to the notification area.
func (*NotifyIcon) Close ¶
func (ni *NotifyIcon) Close() error
Close deletes the NotifyIcon from the notification area.
func (*NotifyIcon) CreateMenu ¶
func (ni *NotifyIcon) CreateMenu() *Menu
CreateMenu creates a new context menu.
func (*NotifyIcon) Modify ¶
func (ni *NotifyIcon) Modify() error
Modify modifies the NotifyIcon in the notification area.
func (*NotifyIcon) Notify ¶
func (ni *NotifyIcon) Notify(n *Notification) error
Notify displays a notification.
type VersionError ¶
type VersionError string
VersionError represents that it requires newer Windows version to perform the specified operation.
func (VersionError) Error ¶
func (e VersionError) Error() string