diff options
author | Andinus <andinus@nand.sh> | 2020-03-22 01:04:49 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-03-22 01:04:49 +0530 |
commit | c3ff3d068fdeacacec1f693bf9513742983814ad (patch) | |
tree | 4a726ecff45639f031aa116ffd7bd17b6a5dd5c2 /notification | |
parent | b032caa8fed86c6a4a74fe6c7019fb6189a90471 (diff) | |
download | indus-c3ff3d068fdeacacec1f693bf9513742983814ad.tar.gz |
Add notification package
Diffstat (limited to 'notification')
-rw-r--r-- | notification/notify.go | 20 |
1 files changed, 20 insertions, 0 deletions
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 +} |