Package notify provides an implementation of the Gnome DBus Notifications Specification.

Overview

go-notify

PkgGoDev

Package notify provides an implementation of the Gnome DBus Notifications Specification.

Examples

Display a simple notification.

ntf := notify.NewNotification("Test Notification", "Just a test")
if _, err := ntf.Show(); err != nil {
	return
}

Display a notification with an icon. Consult the Icon Naming Specification.

ntf := notify.NewNotification("Test Notification", "Just a test")
ntf.AppIcon = "network-wireless"
if _, err := ntf.Show(); err != nil {
	return
}

Display a notification that never expires.

ntf := notify.NewNotification("Test Notification", "Just a test")
ntf.Timeout = notify.ExpiresNever
if _, err := ntf.Show(); err != nil {
	return
}

Play a sound with the notification.

ntf := notify.NewNotification("Test Notification", "Just a test")
ntf.Hints = make(map[string]interface{})
ntf.Hints[notify.HintSoundFile] = "/home/my-username/sound.oga"
if _, err := ntf.Show(); err != nil {
	return
}
Issues
  • Fixed bug in Hint Urgency

    Fixed bug in Hint Urgency

    Hello,

    I was trying to set the hint urgency but received a panic when trying to run the program.

    For example this program panics with an error "Invalid type int":

    $ cat notify.go 
    package main
    
    import "github.com/TheCreeper/go-notify"
    
    func main() {
            ntf := notify.NewNotification("Test Notification", "Just a test")
            ntf.Hints = make(map[string]interface{})
    
            ntf.Hints[notify.HintUrgency] = notify.UrgencyCritical
    
            if _, err := ntf.Show(); err != nil {
                    return
            }
    }
    
    $ go run notify.go 
    panic: dbus: invalid type int
    
    goroutine 1 [running]:
    github.com/godbus/dbus.getSignature(0x7fb9020ba080, 0x562e80, 0x0, 0x0)
            /home/mitch/prog/go/src/github.com/godbus/dbus/sig.go:105 +0x1c2
    github.com/godbus/dbus.SignatureOf(0xc820053b48, 0x1, 0x1, 0x0, 0x0)
            /home/mitch/prog/go/src/github.com/godbus/dbus/sig.go:37 +0x16e
    github.com/godbus/dbus.MakeVariant(0x562e80, 0xc820076750, 0x0, 0x0, 0x0, 0x0)
            /home/mitch/prog/go/src/github.com/godbus/dbus/variant.go:20 +0x99
    github.com/TheCreeper/go-notify.Notification.Show(0x0, 0x0, 0x0, 0x0, 0x0, 0x603840, 0x11, 0x5e6c90, 0xb, 0x0, ...)
            /home/mitch/prog/go/src/github.com/TheCreeper/go-notify/notify.go:223 +0x178
    main.main()
            /home/mitch/prog/go/src/github.com/majormjr/gonotify/notify.go:11 +0x1c4
    
    goroutine 17 [syscall, locked to thread]:
    runtime.goexit()
            /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1
    exit status 2
    

    Changing the urgency type to bytes fixes this error and I can set the notification urgency correctly.

    I've also added some tests to check the urgency levels.

    opened by mroote 1
⚡ HTTP/2 Apple Push Notification Service (APNs) push provider for Go — Send push notifications to iOS, tvOS, Safari and OSX apps, using the APNs HTTP/2 protocol.

APNS/2 APNS/2 is a go package designed for simple, flexible and fast Apple Push Notifications on iOS, OSX and Safari using the new HTTP/2 Push provide

Adam Jones 2.7k Aug 5, 2022
💨 A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps.

Beaver A Real Time Messaging Server. Beaver is a real-time messaging server. With beaver you can easily build scalable in-app notifications, realtime

Ahmed 1.4k Aug 12, 2022
Sending line notifications using a binary, docker or Drone CI.

drone-line Sending line notifications using a binary, docker or Drone CI. Register Line BOT API Trial Please refer to LINE Business Center. Feature Se

Bo-Yi Wu 77 Jun 20, 2022
A dead simple Go library for sending notifications to various messaging services.

A dead simple Go library for sending notifications to various messaging services. About Notify arose from my own need for one of my api server running

Niko Köser 1.2k Aug 8, 2022
Send slack notifications using Github action

Slack notification This is a simple Slack notification action which runs using a Bot token. Example Action A simple example on how to use this action:

Gergely Brautigam 12 Aug 9, 2021
Golang tool to send notifications to LINE app

Golang tool to send notifications to LINE app

Muhammad Daffa 3 Dec 15, 2021
ntfy is a super simple pub-sub notification service. It allows you to send desktop notifications via scripts.

ntfy ntfy (pronounce: notify) is a super simple pub-sub notification service. It allows you to send desktop and (soon) phone notifications via scripts

Philipp C. Heckel 2.6k Aug 18, 2022
Bark is an iOS App which allows you to push customed notifications to your iPhone.

Bark is an iOS App which allows you to push customed notifications to your iPhone.

Feng 1.5k Aug 11, 2022
A simple microservice which accepts incoming notifications

Notifier A simple microservice which accepts incoming notifications, and questions and redirects them to notification sinks such as Telegram, Email et

Albert 7 May 21, 2022
redisqueue provides a producer and consumer of a queue that uses Redis streams

redisqueue redisqueue provides a producer and consumer of a queue that uses Redis streams. Features A Producer struct to make enqueuing messages easy.

Robin Joseph 85 Aug 12, 2022
Uniqush is a free and open source software system which provides a unified push service for server side notification to apps on mobile devices.

Homepage Download Blog/News @uniqush Introduction Uniqush (\ˈyü-nə-ku̇sh\ "uni" pronounced as in "unified", and "qush" pronounced as in "cushion") is

Uniqush 1.4k Aug 9, 2022
A wrapper of streadway/amqp that provides reconnection logic and sane defaults

go-rabbitmq Wrapper of streadway/amqp that provides reconnection logic and sane defaults. Hit the project with a star if you find it useful ⭐ Supporte

Lane Wagner 371 Aug 11, 2022
graylog-golang is a full implementation for sending messages in GELF (Graylog Extended Log Format) from Go (Golang) to Graylog

graylog-golang is a full implementation for sending messages in GELF (Graylog Extended Log Format) from Go (Golang) to Graylog

Robert Kowalski 78 Aug 1, 2022
🔊Minimalist message bus implementation for internal communication

?? Bus Bus is a minimalist event/message bus implementation for internal communication. It is heavily inspired from my event_bus package for Elixir la

Mustafa Turan 272 Aug 5, 2022
The implementation of the pattern observer

Event This is package implements pattern-observer Fast example import ( "github.com/agoalofalife/event" ) func main() { // create struct e := even

Ilya 47 Jul 12, 2022
mangos is a pure Golang implementation of nanomsg's "Scalablilty Protocols"

mangos Mangos™ is an implementation in pure Go of the SP (“Scalability Protocols”) messaging system. These are colloquially known as a “nanomsg”. ❗ Th

nanomsg 534 Aug 6, 2022
Server-sent live updates: protocol and reference implementation

Protocol and Reference Implementation Mercure is a protocol allowing to push data updates to web browsers and other HTTP clients in a convenient, fast

Kévin Dunglas 3k Aug 15, 2022
Implementation of the NELI leader election protocol for Go and Kafka

goNELI Implementation of the NELI leader election protocol for Go and Kafka. goNELI encapsulates the 'fast' variation of the protocol, running in excl

Obsidian Dynamics 58 Jul 6, 2022
Embedded, Fast and Persistent bigqueue implementation

bigqueue bigqueue provides embedded, fast and persistent queue written in pure Go using memory mapped (mmap) files. bigqueue is now thread safe as wel

null 431 Aug 1, 2022