From a6b03fa4bb89a8f0c3546f720d5b35178c29f499 Mon Sep 17 00:00:00 2001 From: Andinus Date: Mon, 23 Mar 2020 13:32:16 +0530 Subject: Add notify functionality to cetus --- cmd/cetus/apod.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cmd/cetus/apod.go') diff --git a/cmd/cetus/apod.go b/cmd/cetus/apod.go index b99d899..cb5abae 100644 --- a/cmd/cetus/apod.go +++ b/cmd/cetus/apod.go @@ -7,6 +7,7 @@ import ( "framagit.org/andinus/cetus/pkg/apod" "framagit.org/andinus/cetus/pkg/background" + "framagit.org/andinus/indus/notification" ) func execAPOD() { @@ -77,6 +78,18 @@ func execAPOD() { apod.Print(res) } + // Send a desktop notification if notify flag was passed + if *apodNotify { + n := notification.Notif{} + n.Title = res.Title + n.Message = fmt.Sprintf("%s\n\n%s", + res.Date, + res.Explanation) + + err = n.Notify() + chkErr(err) + } + // Proceed only if the command was set because if it was fetch // then it's already finished & should exit now. if os.Args[1] == "fetch" { -- cgit 1.4.1-2-gfad0