desktopnotify

package
v1.30.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package desktopnotify posts native desktop notifications from the daemon. On Linux it calls org.freedesktop.Notifications on the session bus using the godbus dependency lerd already ships; other platforms are no-ops for now.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppInstalled

func AppInstalled() bool

AppInstalled reports whether the Lerd desktop app is registered as the lerd:// scheme handler, so callers can prefer it over a browser.

func Emit

func Emit(req Request) (uint32, error)

Emit shows a native notification and returns the daemon-assigned id.

func IconPath

func IconPath() string

IconPath materializes the bundled lerd icon to a stable cache path and returns its absolute path. Notification daemons that ignore themed names still show the logo this way. Returns "" on failure, letting the daemon draw its default.

func OpenApp

func OpenApp(route string) error

OpenApp focuses (or launches) the desktop app at the given dashboard route via its lerd:// scheme.

func Supported

func Supported() bool

Supported reports whether native notifications can be delivered on this host. True when a daemon already owns the well-known name (GNOME, KDE, which run it as part of the session) or when the name is D-Bus activatable (mako, dunst, xfce4-notifyd, which auto-start on the first Notify). False on a headless host with no session bus and no daemon, so callers fall back to the browser sink.

Types

type Request

type Request struct {
	AppName string
	Icon    string // themed icon name or absolute path; "" shows the daemon default
	Summary string
	Body    string
	Urgency Urgency
	Route   string // dashboard route to open on click; "" makes the popup inert
}

Request is a single native notification to show.

type Urgency

type Urgency byte

Urgency maps to the org.freedesktop.Notifications "urgency" hint byte.

const (
	UrgencyLow      Urgency = 0
	UrgencyNormal   Urgency = 1
	UrgencyCritical Urgency = 2
)

func UrgencyFromString

func UrgencyFromString(s string) Urgency

UrgencyFromString maps lerd's notification urgency strings to the DBus hint. Unknown or empty values are Normal, matching the Web Push default.

Jump to

Keyboard shortcuts

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