summary refs log blame commit diff stats
path: root/notification/notify_unix.go
blob: a6fc3acd687ea32931bb841a3ef5be90f1722624 (plain) (tree)




















                                                                                       
// +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
}