From c3ff3d068fdeacacec1f693bf9513742983814ad Mon Sep 17 00:00:00 2001 From: Andinus Date: Sun, 22 Mar 2020 01:04:49 +0530 Subject: Add notification package --- notification/notify.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 notification/notify.go diff --git a/notification/notify.go b/notification/notify.go new file mode 100644 index 0000000..4617a38 --- /dev/null +++ b/notification/notify.go @@ -0,0 +1,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 +} -- cgit 1.4.1-2-gfad0