notification

package
v0.0.0-...-2b48b92 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAvailable

func IsAvailable() bool

IsAvailable checks if the machine has notification support and returns true if it does, false otherwise.

Example:

if notification.IsAvailable() == false {
	fmt.Printf("Desktop notifications are not available")
	return
}

func SendNotification

func SendNotification(notification *types.Notification) error

SendNotification sends a desktop notification. It requires a Notification instance as an argument, you can create one using the types.NewNotification function.

Example:

notification := types.NewNotification(
	"BatmanApp",
	"Batman Alert",
	"Joker is attacking Gotham City!",
	"batman",
	5000,
	types.NotificationAction{
		Label: "Save Gotham",
		Callback: func() {
			fmt.Printf("Gotham saved!")
		},
	},
)

err := notification.Send()
if err != nil {
	fmt.Printf("Error: %v\n", err)
	return
}

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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