notifications

package
v0.0.0-...-6789dc4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package notifications wraps a couple of Notifications's DBus API points: the org.freedesktop.Notifications.Notify call, and listening for the ActionInvoked signal.

Index

Constants

This section is empty.

Variables

View Source
var BusAddress bus.Address = bus.Address{
	Interface: "org.freedesktop.Notifications",
	Path:      "/org/freedesktop/Notifications",
	Name:      "org.freedesktop.Notifications",
}

Notifications lives on a well-knwon bus.Address

Functions

This section is empty.

Types

type RawAction

type RawAction struct {
	App      *click.AppId `json:"app,omitempty"`
	Action   string       `json:"act,omitempty"`
	ActionId int          `json:"aid,omitempty"`
	Nid      string       `json:"nid,omitempty"`
	RawId    uint32       `json:"-"`
}

convenience type for the (uint32, string) ActionInvoked signal data

type RawNotifications

type RawNotifications struct {
	// contains filtered or unexported fields
}

a raw notification provides a low-level interface to the f.d.o. dbus notifications api

func Raw

func Raw(endp bus.Endpoint, log logger.Logger, sound sounds.Sound) *RawNotifications

Raw returns a new RawNotifications that'll use the provided bus.Endpoint

func (*RawNotifications) Notify

func (raw *RawNotifications) Notify(
	app_name string, reuse_id uint32,
	icon, summary, body string,
	actions []string, hints map[string]*dbus.Variant,
	timeout int32) (uint32, error)

Notify fires a notification

func (*RawNotifications) Present

func (raw *RawNotifications) Present(app *click.AppId, nid string, notification *launch_helper.Notification) bool

Present displays a given card.

If card.Actions is empty it's a plain, noninteractive bubble notification. If card.Actions has 1 action, it's an interactive notification. If card.Actions has 2 actions, it will show as a snap decision. If it has more actions, who knows (good luck).

func (*RawNotifications) WatchActions

func (raw *RawNotifications) WatchActions() (<-chan *RawAction, error)

WatchActions listens for ActionInvoked signals from the notification daemon and sends them over the channel provided

Jump to

Keyboard shortcuts

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