From c551d98a53c393140c54e955b1d4fd7005f43b54 Mon Sep 17 00:00:00 2001 From: Caroline Larimore Date: Mon, 21 Apr 2025 17:07:11 -0700 Subject: Add proper expiration and sort settings --- srv/server.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'srv/server.go') diff --git a/srv/server.go b/srv/server.go index 27ced3f..2500f62 100644 --- a/srv/server.go +++ b/srv/server.go @@ -11,8 +11,8 @@ import ( "github.com/godbus/dbus/v5" ) -const DEFAULT_EXPIRATION = 5000 -const SORT_DIRECTION = 1 // 1 = newest first, -1 = oldest first +var DEFAULT_EXPIRATION int +var SORT_DIRECTION int // 1 = newest first, -1 = oldest first type server struct { notifications *notificationStack @@ -80,12 +80,15 @@ func (s server) output() { fmt.Println(string(j)) } -func Start() { +func Start(defaultExpiration int, sortDirection int) { const NOTIF_DBUS_OBJECT = "/org/freedesktop/Notifications" const NOTIF_DBUS_NAME = "org.freedesktop.Notifications" const CORVID_DBUS_OBJECT = "/sh/cxl/Corvid" const CORVID_DBUS_NAME = "sh.cxl.Corvid" + DEFAULT_EXPIRATION = defaultExpiration + SORT_DIRECTION = sortDirection + notifications := notificationStack{ mutex: &sync.Mutex{}, notifications: make(map[uint32]notification), -- cgit v1.2.3