summary refs log tree commit diff stats
path: root/notification/notify_unix.go
blob: a6fc3acd687ea32931bb841a3ef5be90f1722624 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// +build linux netbsd openbsd freebsd dragonfly

package notification

import (
	"fmt"
	"os/exec"
)

// Notify sends a desktop notification to the user using libnotify. It
// handles information in the form of Notif struct. It returns an
// error (if exists).
func (n Notif) Notify() error {
	err := exec.Command("notify-send", n.Title, n.Message).Run()
	if err != nil {
		err = fmt.Errorf("%s\n%s",
			"notify_unix.go: failed to sent notification with notify-send",
			err.Error())
	}
	return err
}