/*
* DWN - Desktop Window Manager
* retoor <retoor@molodetz.nl>
* D-Bus Notification daemon
*/
#ifndef DWN_NOTIFICATIONS_H
#define DWN_NOTIFICATIONS_H
#include "dwn.h"
#include <stdbool.h>
#include <dbus/dbus.h>
/* Notification urgency levels */
typedef enum {
NOTIFY_URGENCY_LOW,
NOTIFY_URGENCY_NORMAL,
NOTIFY_URGENCY_CRITICAL
} NotifyUrgency;
/* Notification structure */
typedef struct Notification {
uint32_t id;
char app_name[64];
char summary[512]; /* Larger summary for AI responses */
char *body; /* Dynamically allocated - unlimited size */
size_t body_len; /* Length of body text */
char icon[256];
int timeout; /* -1 = default, 0 = never, >0 = milliseconds */
NotifyUrgency urgency;
long expire_time; /* Timestamp when notification should disappear */
Window window; /* X11 window for rendering */
int width; /* Dynamic width based on content */
int height; /* Dynamic height based on content */
struct Notification *next;
} Notification;
/* D-Bus connection */
extern DBusConnection *dbus_conn;
/* Initialization */
bool notifications_init(void);
void notifications_cleanup(void);
/* D-Bus handling */
void notifications_process_messages(void);
bool notifications_register_service(void);
/* Notification management */
uint32_t notification_show(const char *app_name, const char *summary,
const char *body, const char *icon, int timeout);
void notification_close(uint32_t id);
void notification_close_all(void);
Notification *notification_find(uint32_t id);
Notification *notification_find_by_window(Window window);
/* Rendering */
void notification_render(Notification *notif);
void notifications_render_all(void);
void notifications_update(void);
void notifications_position(void);
void notifications_raise_all(void);
/* D-Bus method handlers */
DBusHandlerResult notifications_handle_message(DBusConnection *conn,
DBusMessage *msg,
void *user_data);
/* Server info */
void notifications_get_server_info(const char **name, const char **vendor,
const char **version, const char **spec_version);
void notifications_get_capabilities(const char ***caps, int *count);
#endif /* DWN_NOTIFICATIONS_H */