summary refs log tree commit diff stats
path: root/notification/notify_unix.go
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-03-25 00:13:51 +0530
committerAndinus <andinus@nand.sh>2020-03-25 00:13:51 +0530
commit3ee3715ae7777dd6c1804974e2e293406fd1fe54 (patch)
treef035e76ff9ce48d03299381d03906eaff76140dc /notification/notify_unix.go
parent28e35c0b0b996e17bd94a5b9e78fda90086ba85e (diff)
downloadcetus-3ee3715ae7777dd6c1804974e2e293406fd1fe54.tar.gz
Add apod support & fix errors
Diffstat (limited to 'notification/notify_unix.go')
-rw-r--r--notification/notify_unix.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/notification/notify_unix.go b/notification/notify_unix.go
new file mode 100644
index 0000000..a6fc3ac
--- /dev/null
+++ b/notification/notify_unix.go
@@ -0,0 +1,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
+}