notify

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 9 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 notify sends system-wide notifications to logged-in users through an injected exec.Runner. It uses wall for terminal sessions and notify-send for graphical sessions. Methods return an aggregated error of every delivery that ran and failed; an absent capability (no notify-send, no D-Bus socket, no sessions) is a graceful skip, not an error. The SDK surfaces failures; the caller decides whether to ignore them (notifications need not block an action).

r, _ := exec.NewRunner(exec.Sudo)
n, _ := notify.New(r)
n.NotifyAll(ctx, "Maintenance", "Reboot in 5 minutes")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// NotifyAll notifies every logged-in user: a wall broadcast to terminal
	// sessions and a desktop notification to graphical ones. It returns an
	// aggregated error of every attempt that ran and failed; an absent capability
	// (no notify-send, no D-Bus socket, no sessions) is a graceful skip, not an
	// error. The SDK surfaces failures; the caller decides whether to ignore them.
	NotifyAll(ctx context.Context, title, message string) error
	// NotifyUsers notifies the named users only (wall still broadcasts, since it
	// has no per-user target). Error semantics match NotifyAll.
	NotifyUsers(ctx context.Context, usernames []string, title, message string) error
}

Manager sends notifications to logged-in users. Methods return an aggregated error of deliveries that ran and failed; an absent capability is a graceful skip (nil).

func New

func New(runner exec.Runner) (Manager, error)

New returns a Manager driven by runner. A nil runner is rejected.

Jump to

Keyboard shortcuts

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