notificationDaemon

package
v0.0.0-...-bbe9fb7 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// LockFilePath is used for the file lock.
	// If empty, it defaults to $XDG_RUNTIME_DIR/notificationdaemon.lock or /tmp/notificationdaemon.lock.
	LockFilePath string
	// You can add additional customization options here.
	Capabilities []string
}

Config allows customization of the daemon.

type Daemon

type Daemon struct {
	Notifications map[uint32]Notification

	NotificationsChannel chan NotificationEvent
	Logger               slog.Logger
	// contains filtered or unexported fields
}

Daemon implements the org.freedesktop.Notifications interface.

func NewDaemon

func NewDaemon(config Config) *Daemon

NewDaemon creates a new NotificationDaemon instance.

func (*Daemon) CloseNotification

func (d *Daemon) CloseNotification(id uint32) *dbus.Error

CloseNotification implements the CloseNotification method.

func (*Daemon) CloseNotificationAsUser

func (d *Daemon) CloseNotificationAsUser(id uint32) error

func (*Daemon) GetCapabilities

func (d *Daemon) GetCapabilities() ([]string, *dbus.Error)

GetCapabilities returns the capabilities supported by the notification server.

func (*Daemon) GetServerInformation

func (d *Daemon) GetServerInformation() (string, string, string, string, *dbus.Error)

GetServerInformation returns static information about the notification server.

func (*Daemon) InvokeAction

func (d *Daemon) InvokeAction(id uint32, action_key string)

func (*Daemon) Notify

func (d *Daemon) Notify(appName string, replacesID uint32, appIcon string, summary string, body string, actions []string, hints map[string]dbus.Variant, expireTimeout int32) (uint32, *dbus.Error)

Notify implements the Notify method as defined in the Desktop Notifications spec. It creates (or replaces) a notification and returns its ID.

func (*Daemon) Start

func (d *Daemon) Start() error

Start initializes the DBus connection and registers the Notifications service.

func (*Daemon) Stop

func (d *Daemon) Stop()

Stop shuts down the daemon.

type Notification

type Notification struct {
	ID            uint32
	AppName       string
	AppIcon       string
	Summary       string
	Body          string
	Actions       []string
	Hints         map[string]dbus.Variant
	ExpireTimeout int32
	Timestamp     time.Time
}

Notification represents a notification event.

type NotificationEvent

type NotificationEvent struct {
	Notification Notification
	Created      bool
	Modified     bool
	Deleted      bool
}

Jump to

Keyboard shortcuts

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