aboutsummaryrefslogtreecommitdiff
path: root/snotif.h
diff options
context:
space:
mode:
authorjakob.stendahl <jakob.stendahl@infomedia.dk>2024-07-12 18:02:47 +0200
committerjakob.stendahl <jakob.stendahl@infomedia.dk>2024-07-12 18:02:47 +0200
commited74ab2d27460ec11a29f6d005a003d69104d7c5 (patch)
tree0ca5295ed6ab640db1d6d5dd4b7fc0d79210ccc5 /snotif.h
downloadsimple-notification-daemon-ed74ab2d27460ec11a29f6d005a003d69104d7c5.tar.gz
simple-notification-daemon-ed74ab2d27460ec11a29f6d005a003d69104d7c5.zip
Initial commit
Diffstat (limited to 'snotif.h')
-rw-r--r--snotif.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/snotif.h b/snotif.h
new file mode 100644
index 0000000..dd52ac4
--- /dev/null
+++ b/snotif.h
@@ -0,0 +1,48 @@
+#ifndef SNOTIF_H
+#define SNOTIF_H
+
+#include <dbus/dbus.h>
+#include <stdbool.h>
+#include <time.h>
+
+// Constansts for the DBus interactions
+#define DBUS_NOTIF_INTERFACE "org.freedesktop.Notifications"
+#define DBUS_CLIENT_INTERFACE "snotifd.Notifications"
+#define DBUS_CLIENT_OBJECT "/snotifd/Notifications"
+#define DBUS_METHOD_GETLIST "GetNotifications"
+#define DBUS_METHOD_GETUNSEENCOUNT "GetUnseenCount"
+#define DBUS_METHOD_SETSEEN "SetSeen"
+
+// Curses related constants
+#define CPAIR_SEL 132
+#define CPAIR_B 4
+
+// Extended struct from the specification at:
+// https://specifications.freedesktop.org/notification-spec/latest/ar01s09.html
+struct NotifyParams {
+ unsigned int id;
+ char* app_name;
+ dbus_uint32_t replaces_id;
+ char* app_icon;
+ char* summary;
+ char* body;
+ dbus_int32_t expire_timeout;
+ time_t time;
+ bool seen;
+};
+
+// Convenient struct for keeping a list of notifications
+struct NotifsList {
+ struct NotifyParams** list;
+ size_t element_count;
+ size_t list_size;
+};
+
+// Convenient methods for working with a list of notifications
+char* strnotify_params(const struct NotifyParams* params);
+void notifs_list_init(struct NotifsList** list);
+void notifs_list_set(struct NotifsList* list, struct NotifyParams* notif);
+void notifs_list_free(struct NotifsList* list);
+int notifs_list_set_seen(struct NotifsList* list, unsigned int id, bool read);
+
+#endif