notify

package module
v0.0.0-...-0636319 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2015 License: GPL-3.0 Imports: 2 Imported by: 0

README

go-notify

go-notify

Package notify provides an implementation of the Freedesktop Notifications Specification using the DBus API.

Example

package main

import (
	"log"

	"github.com/TheCreeper/go-notify"
)

func main() {

	ntf, err := notify.NewNotification("Test Notification", "This is a test notification")
	if err != nil {

		log.Fatal(err)
	}

	if _, err := ntf.Send(); err != nil {

		log.Fatal(err)
	}
}

Documentation

Index

Constants

View Source
const (
	ExpiresDefault = -1
	ExpiresNever   = 0
)

Notification expire times

View Source
const (
	Device              = "device"
	DeviceAdded         = "device.added"
	DeviceError         = "device.error"
	DeviceRemoved       = "device.removed"
	Email               = "email"
	EmailArrived        = "email.arrived"
	EmailBounced        = "email.bounced"
	Im                  = "im"
	ImError             = "im.error"
	ImReceived          = "im.received"
	Network             = "network"
	NetworkConnected    = "network.connected"
	NetworkDisconnected = "network.disconnected"
	NetworkError        = "network.error"
	Presence            = "presence"
	PresenceOffline     = "presence.offline"
	PresenceOnline      = "presence.online"
	Transfer            = "transfer"
	TransferComplete    = "transfer.complete"
	TransferError       = "transfer.error"
)

Categories

View Source
const (
	UrgencyLow      = 0
	UrgencyNormal   = 1
	UrgencyCritical = 2
)

Urgency Levels

View Source
const (
	ActionIcons    = "action-icons"
	Actions        = "actions"
	Body           = "body"
	BodyHyperlinks = "body-hyperlinks"
	BodyImages     = "body-images"
	BodyMarkup     = "body-markup"
	IconMulti      = "icon-multi"
	IconStatic     = "icon-static"
	Persistence    = "persistence"
	Sound          = "sound"
)

Capabilities

Variables

This section is empty.

Functions

func CloseNotification

func CloseNotification(id uint32) (err error)

Closes the notification if it exists using its id

Types

type Capabilities

type Capabilities struct {
	ActionIcons    bool
	Actions        bool
	Body           bool
	BodyHyperlinks bool
	BodyImages     bool
	BodyMarkup     bool
	IconMulti      bool
	IconStatic     bool
	Persistence    bool
	Sound          bool
}

func GetCapabilities

func GetCapabilities() (c *Capabilities, err error)

Returns the capabilities of the notification server

type Notification

type Notification struct {

	// The optional name of the application sending the notification. Can be blank.
	AppName string

	// The optional notification ID that this notification replaces.
	ReplacesID uint32

	// The optional program icon of the calling application.
	AppIcon string

	// The summary text briefly describing the notification.
	Summary string

	// The optional detailed body text.
	Body string

	// The actions send a request message back to the notification client when invoked.
	Actions []string

	// Optional hints that can be passed to the server from the client program.
	Hints map[string]string

	// The timeout time in milliseconds since the display of the notification at which the notification should automatically close.
	Timeout int32
}

func NewNotification

func NewNotification(summary, body string) (n *Notification, err error)

Create a new notification object with some basic information

func (*Notification) Show

func (n *Notification) Show() (id uint32, err error)

Send the notification

type ServerInformation

type ServerInformation struct {

	// The name of the notification server daemon
	Name string

	// The vendor of the notification server
	Vendor string

	// Version of the notification server
	Version string

	// Spec version the notification server conforms to
	SpecVersion string
}

func GetServerInformation

func GetServerInformation() (i *ServerInformation, err error)

Gets information about the notification server

Jump to

Keyboard shortcuts

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