desktopnotify

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package desktopnotify sends freedesktop notifications over the session bus: D-Bus directly rather than notify-send, whose absence from PATH would silently drop every notification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Notify

func Notify(appName, summary, body, appIcon string)

Notify is Send on a fresh session-bus connection, on its own goroutine: errors are logged, never returned, since a missing notification must not fail the caller's real work.

Types

type Action

type Action struct {
	Key   string
	Label string
}

Action is one notification button: Key is what Ask reports, Label what the daemon shows.

type Sender

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

Sender delivers notifications on one bus connection.

func NewSender

func NewSender(conn *dbus.Conn) *Sender

NewSender wraps an existing connection; the caller owns it.

func (*Sender) Ask

func (s *Sender) Ask(ctx context.Context, appName, summary, body, appIcon string, actions []Action, timeout time.Duration) (key string, ok bool, err error)

Ask posts a notification with buttons and waits for the user: the key of the button pressed, or ok=false when the notification closed or expired without one, or ctx ended first. timeout is the daemon's expire timeout. The icon also goes in the image-path hint, as libnotify does, which lys-shell's own popup reads. Only what the daemon says after it answered Notify is about this notification: an id it used before may be the one it hands out again.

func (*Sender) Send

func (s *Sender) Send(ctx context.Context, appName, summary, body, appIcon string) (uint32, error)

Send posts one notification with the daemon's default timeout and returns its id. appIcon is a themed icon name or an absolute path.

func (*Sender) SendCritical

func (s *Sender) SendCritical(ctx context.Context, appName, summary, body, appIcon string) (uint32, error)

SendCritical is Send at critical urgency.

Jump to

Keyboard shortcuts

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