notify

package
v0.0.0-...-dddda54 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ExpiresDefault     = -1
	ExpiresNever       = 0
	ExpiresMillisecond = 1
	ExpiresSecond      = 1000
)
View Source
const (
	// When set, a server that has the "action-icons" capability will attempt to interpret
	// any action identifier as a named icon. The localized display name will be used to
	// annotate the icon for accessibility purposes.
	// The icon name should be compliant with the Freedesktop.org Icon Naming Specification.
	// type: bool
	HintActionIcons = "action-icons"

	// The type of notification this is.
	// type: string
	HintCategory = "category"

	// This specifies the name of the desktop filename representing the calling program.
	// This should be the same as the prefix used for the application's .desktop file.
	// An example would be "rhythmbox" from "rhythmbox.desktop".
	// This can be used by the daemon to retrieve the correct icon for the application,
	// for logging purposes, etc.
	// type: string
	HintDesktopEntry = "desktop-entry"

	// 	This is a raw data image format which describes the width, height, rowstride,
	// has alpha, bits per sample, channels and image data respectively.
	// type: (iiibiiay)
	HintImageData = "image-data"

	// Alternative way to define the notification image.
	// type: string
	HintImagePath = "image-path"

	// When set the server will not automatically remove the notification when an action
	// has been invoked. The notification will remain resident in the server until it is
	// explicitly removed by the user or by the sender. This hint is likely only useful
	// when the server has the "persistence" capability.
	// type: bool
	HintResident = "resident"

	// The path to a sound file to play when the notification pops up.
	// type: string
	HintSoundFile = "sound-file"

	// A themeable named sound from the freedesktop.org sound naming specification to play
	// when the notification pops up. Similar to icon-name, only for sounds.
	// An example would be "message-new-instant".
	// type: string
	HintSoundName = "sound-name"

	// Causes the server to suppress playing any sounds, if it has that ability.
	// This is usually set when the client itself is going to play its own sound.
	// type: bool
	HintSuppressSound = "suppress-sound"

	// When set the server will treat the notification as transient and by-pass the server's
	// persistence capability, if it should exist.
	// type: bool
	HintTransient = "transient"

	// Specifies the X location on the screen that the notification should point to.
	// The "y" hint must also be specified.
	// type: int32
	HintX = "x"

	// Specifies the Y location on the screen that the notification should point to.
	// The "x" hint must also be specified.
	// type: int32
	HintY = "y"

	// The urgency level.
	// type: byte
	HintUrgency = "urgency"
)

hints

View Source
const (
	ClosedReasonInvalid               = -1
	ClosedReasonExpired               = 1
	ClosedReasonDismissedByUser       = 2
	ClosedReasonCallCloseNotification = 3
	ClosedReasonUnknown               = 4
)
View Source
const (
	UrgencyLow      = 0
	UrgencyNormal   = 1
	UrgencyCritical = 2
)

Variables

This section is empty.

Functions

func Destroy

func Destroy()

This should be called when the program no longer needs libnotify for the rest of its lifecycle, typically just before exitting.

func GetAppName

func GetAppName() string

func GetServerCaps

func GetServerCaps() ([]string, error)

func Init

func Init(appName string) bool

This must be called before anny other functions.

func IsInitted

func IsInitted() bool

Gets whether or not libnotify is initialized.

func SetAppName

func SetAppName(name string)

Types

type ActionCallback

type ActionCallback func(n *Notification, action string)

type ClosedReason

type ClosedReason int

func (ClosedReason) String

func (i ClosedReason) String() string

type Image

type Image struct {
	Width         int32
	Height        int32
	RowStride     int32
	HasAlpha      bool
	BitsPerSample int32
	Channels      int32
	Pix           []byte
}

This is a raw data image format which describes the width, height, rowstride, has alpha, bits per sample, channels and image data respectively.

func NewImage

func NewImage(src image.Image) *Image

type Notification

type Notification struct {
	AppName string
	Summary string
	Body    string
	Icon    string
	Timeout int32
	// contains filtered or unexported fields
}

func NewNotification

func NewNotification(summary, body, icon string) *Notification

Create a new Notification. summary text is required, but all other paramters are optional.

func (*Notification) AddAction

func (n *Notification) AddAction(action, label string, callback ActionCallback)

func (*Notification) ClearActions

func (n *Notification) ClearActions()

func (*Notification) ClearHints

func (n *Notification) ClearHints()

func (*Notification) Close

func (n *Notification) Close() error

func (*Notification) Closed

func (n *Notification) Closed() *event.Event

func (*Notification) Destroy

func (n *Notification) Destroy()

func (*Notification) GetClosedReason

func (n *Notification) GetClosedReason() ClosedReason

func (*Notification) SetCategory

func (n *Notification) SetCategory(category string)

Sets the category of this notification. This can be used by the notification server to filter or display the data in a certain way.

func (*Notification) SetHint

func (n *Notification) SetHint(key string, value interface{})

func (*Notification) SetImage

func (n *Notification) SetImage(img image.Image)

func (*Notification) SetUrgency

func (n *Notification) SetUrgency(urgency byte)

Sets the urgency level of this notification.

func (*Notification) Show

func (n *Notification) Show() error

Tells the notification server to display the notification on the screen.

func (*Notification) Update

func (n *Notification) Update(summary, body, icon string)

Updates the notification text and icon. This won't send the update out and display it on the screen. For that, you will need to call Show()

type ServerInfo

type ServerInfo struct {
	Name, Vendor, Version, SpecVersion string
}

func GetServerInfo

func GetServerInfo() (*ServerInfo, error)

name string, vendor string, version string, spec_version string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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