notify

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT, Unlicense Imports: 4 Imported by: 16

README

notify

Go Reference

Cross platform notifications for Gio applications.

Status

This repo is experimental, and does not have a stable interface. Currently niotify only supports the following OSes:

  • linux (x11/wayland doesn't matter so long as dbus is used for notifications)
  • android
  • macOS (support is preliminary; some code-signing-related issues)
  • iOS (support is preliminary; some code-signing-related issues)

Use

See the package documentation of ./notification_manager.go for usage information.

Documentation

Overview

Package notify provides cross-platform notifications for Gio applications.

https://gioui.org

Sending a notification is easy:

notifier, _ := NewNotifier()
notification, _ := notifier.CreateNotification("hello!", "I was sent from Gio!")
notification.Cancel()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IconNotifier

type IconNotifier interface {
	Notifier
	UseIcon(path string)
}

IconNotifier is a notifier that can display an icon notification.

type Notification

type Notification interface {
	// Cancel a notification.
	Cancel() error
}

Notification handle that can used to manipulate a platform notification, such as by cancelling it.

func Push

func Push(title, text string) (Notification, error)

Push a notification to the OS.

type Notifier

type Notifier interface {
	CreateNotification(title, text string) (Notification, error)
}

Notifier provides methods for creating and managing notifications.

func NewNotifier

func NewNotifier() (Notifier, error)

NewNotifier creates a new Manager tailored to the current operating system.

type OngoingNotifier

type OngoingNotifier interface {
	Notifier
	// CreateOngoingNotification creates a notification that cannot be dismissed
	// by the user. Callers must be careful to cancel this notification when it
	// is no longer needed.
	CreateOngoingNotification(title, text string) (Notification, error)
}

OngoingNotifier is a notifier that can display an ongoing notification. Some platforms (currently Android) support persistent notifications and will implement this optional interface.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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