66 lines
1.7 KiB
C
Raw Normal View History

2025-12-28 03:14:31 +01:00
/*
* DWN - Desktop Window Manager
* retoor <retoor@molodetz.nl>
2025-12-28 03:14:31 +01:00
* D-Bus Notification daemon
*/
#ifndef DWN_NOTIFICATIONS_H
#define DWN_NOTIFICATIONS_H
#include "dwn.h"
#include <stdbool.h>
#include <dbus/dbus.h>
typedef enum {
NOTIFY_URGENCY_LOW,
NOTIFY_URGENCY_NORMAL,
NOTIFY_URGENCY_CRITICAL
} NotifyUrgency;
typedef struct Notification {
uint32_t id;
char app_name[64];
char summary[512];
char *body;
size_t body_len;
2025-12-28 03:14:31 +01:00
char icon[256];
int timeout;
2025-12-28 03:14:31 +01:00
NotifyUrgency urgency;
long expire_time;
Window window;
int width;
int height;
2025-12-28 03:14:31 +01:00
struct Notification *next;
} Notification;
extern DBusConnection *dbus_conn;
bool notifications_init(void);
void notifications_cleanup(void);
void notifications_process_messages(void);
bool notifications_register_service(void);
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);
void notification_render(Notification *notif);
void notifications_render_all(void);
void notifications_update(void);
void notifications_position(void);
void notifications_raise_all(void);
DBusHandlerResult notifications_handle_message(DBusConnection *conn,
DBusMessage *msg,
void *user_data);
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