From 193391763472dc7845bf8680beba732e0231aab5 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Sun, 4 Feb 2024 00:49:42 +0100 Subject: [PATCH] Add notifications on windows --- agent/notify/unimplemented.go | 2 +- agent/notify/windows.go | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 agent/notify/windows.go diff --git a/agent/notify/unimplemented.go b/agent/notify/unimplemented.go index 330e995..badac69 100644 --- a/agent/notify/unimplemented.go +++ b/agent/notify/unimplemented.go @@ -1,4 +1,4 @@ -//go:build windows || darwin +//go:build darwin package notify diff --git a/agent/notify/windows.go b/agent/notify/windows.go new file mode 100644 index 0000000..7c6e0c9 --- /dev/null +++ b/agent/notify/windows.go @@ -0,0 +1,24 @@ +//go:build windows + +package notify + +import ( + "time" + + "gopkg.in/toast.v1" +) + +func Notify(title string, body string, actionName string, timeout time.Duration, onclose func()) error { + notification := toast.Notification{ + AppID: "Goldwarden", + Title: title, + Message: body, + Audio: toast.Silent, + } + + return notification.Push() +} + +func ListenForNotifications() error { + return nil +}