summary refs log tree commit diff stats
path: root/notification/notify.go
blob: 4617a38aa5410fb29b8ec8f6bbdd9d9bff2af410 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package notification

import (
	"os/exec"
)

// Notif struct holds information about the notification. Other
// parameters like urgency & timeout could be added when required.
type Notif struct {
	Title   string
	Message string
}

// 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()
	return err
}