golibnotify

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: MIT Imports: 3 Imported by: 2

README

golibnotify

golibnotify implements go bindings for libnotify to create, send, and update OS level notifications. It does not shell out to notify-send so it can update existing notifications as well as create new ones.

go.dev reference Go Report Card GitHub Sourcegraph Badge

Installation

This package requires CGO and the libnotify (libnotify-dev) shared library to be installed.

On Ubuntu or Debian using apt, you can install with sudo apt-get install libnotify-dev

Usage

// Get an instance of a SimpleNotifier
notifier := golibnotify.NewSimpleNotifier("my-cool-app-name")

// Show a new notification
err = notifier.Show("A summary", "Some body text", "a/path/to/an/icon.png")

// Update an existing notification (or send a new one if one hasn't been sent)
err = notifier.Update("A new summary", "Some different body text", "another/path/to/icon.png")

// Remove an existing notification
err = notifier.Close()

See also examples for a complete example

Roadmap

  • Add API that returns a Notification instance to manage multiple notifications at once
  • Better support for notification icons (PixBuf?)
  • Support notification timeouts
  • Support notification urgencies

Contributions

Thanks for wanting to contribute!

  1. Open an issue describing your problem, solution, issue, suggestion, feature, etc. to ensure it's likely to get merged.
  2. Fork the project.
  3. Make your changes.
  4. Open a PR against master here.
  5. Celebrate being awesome!

Author

@codegoalie

Documentation

Overview

Package golibnotify implements go bindings for libnotify to create, send, and update OS level notifications. It does not shell out to `notify-send` so it can update existing notifications as well as create new ones.

This package requires CGO and the libnotify (libnotify-dev) shared library to be installed.

On Ubuntu or Debian using apt, you can install with: sudo apt-get install libnotify-dev

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleNotifier

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

SimpleNotifier is an instance of an application sending notifications

func NewSimpleNotifier

func NewSimpleNotifier(applicationName string) *SimpleNotifier

NewSimpleNotifier initializes a new application to send notifications

func (*SimpleNotifier) ApplicationName

func (n *SimpleNotifier) ApplicationName() string

ApplicationName returns the current application's initialized name

func (*SimpleNotifier) Close

func (n *SimpleNotifier) Close() error

Close removes the notification from the OS

func (*SimpleNotifier) Show

func (n *SimpleNotifier) Show(summary, body, icon string) error

Show creates a new notification and sends it to the OS

func (*SimpleNotifier) Update

func (n *SimpleNotifier) Update(summary, body, icon string) error

Update an existing notification with new information

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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