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).