native

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAvailable

func IsAvailable() bool

IsAvailable returns true if native notifications are available.

func Send

func Send(message, title string, urgency int) bool

Send sends a notification using the native notification system.

Types

type LinuxSender

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

LinuxSender sends notifications via notify-send (libnotify).

func (*LinuxSender) IsAvailable

func (s *LinuxSender) IsAvailable() bool

IsAvailable checks if notify-send is available.

func (*LinuxSender) Send

func (s *LinuxSender) Send(message, title string, urgency int) bool

Send sends a notification via notify-send.

func (*LinuxSender) SetAppName added in v0.1.1

func (s *LinuxSender) SetAppName(name string)

SetAppName sets the application name for notifications.

func (*LinuxSender) SetIcon added in v0.1.1

func (s *LinuxSender) SetIcon(icon string)

SetIcon sets the icon for notifications. Can be a stock icon name (e.g., "dialog-information") or a file path.

func (*LinuxSender) SetTimeout added in v0.1.1

func (s *LinuxSender) SetTimeout(ms int)

SetTimeout sets the notification timeout in milliseconds. Use 0 for default, -1 for never expire.

type MacOSSender

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

MacOSSender sends notifications via osascript (AppleScript).

func (*MacOSSender) IsAvailable

func (s *MacOSSender) IsAvailable() bool

IsAvailable checks if osascript is available.

func (*MacOSSender) Send

func (s *MacOSSender) Send(message, title string, urgency int) bool

Send sends a notification via osascript.

type Sender

type Sender interface {
	IsAvailable() bool
	Send(message, title string, urgency int) bool
}

Sender is an interface for sending native notifications.

func GetSender

func GetSender() Sender

GetSender returns the appropriate native notification sender for the current OS.

type WindowsSender

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

WindowsSender sends notifications via PowerShell toast notifications.

func (*WindowsSender) IsAvailable

func (s *WindowsSender) IsAvailable() bool

IsAvailable checks if PowerShell is available on Windows.

func (*WindowsSender) Send

func (s *WindowsSender) Send(message, title string, urgency int) bool

Send sends a notification via PowerShell toast.

Jump to

Keyboard shortcuts

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