1 #pragma once
2 
3 #include <stdint.h>
4 #include <sys/types.h>
5 
6 #include <pixman.h>
7 #include <wayland-client.h>
8 
9 #include "config.h"
10 #include "fdm.h"
11 #include "tllist.h"
12 
13 /* forward declarations, to avoid circular includes */
14 struct wayland;
15 struct dbus;
16 
17 struct notif_mgr;
18 struct notif_mgr *notif_mgr_new(struct config *conf, struct fdm *fdm);
19 void notif_mgr_destroy(struct notif_mgr *mgr);
20 
21 void notif_mgr_configure(
22     struct notif_mgr *mgr, struct wayland *wayl, struct dbus *bus);
23 
24 void notif_mgr_refresh(struct notif_mgr *mgr);
25 
26 ssize_t notif_mgr_get_ids(const struct notif_mgr *mgr, uint32_t *ids, size_t max);
27 
28 bool notif_mgr_expire_id(struct notif_mgr *mgr, uint32_t id);
29 bool notif_mgr_dismiss_id(struct notif_mgr *mgr, uint32_t id);
30 bool notif_mgr_dismiss_all(struct notif_mgr *mgr);
31 
32 struct monitor;
33 void notif_mgr_monitor_removed(struct notif_mgr *mgr, const struct monitor *mon);
34 bool notif_mgr_monitor_updated(struct notif_mgr *mgr, const struct monitor *mon);
35 
36 enum urgency { URGENCY_LOW, URGENCY_NORMAL, URGENCY_CRITICAL };
37 
38 struct notif;
39 struct notif *notif_mgr_create_notif(struct notif_mgr *mgr, uint32_t replaces_id);
40 struct notif *notif_mgr_get_notif(struct notif_mgr *mgr, uint32_t id);
41 struct notif *notif_mgr_get_notif_for_surface(
42     struct notif_mgr *mgr, const struct wl_surface *surface);
43 bool notif_mgr_del_notif(struct notif_mgr *mgr, uint32_t id);
44 
45 void notif_destroy(struct notif *notif);
46 uint32_t notif_id(const struct notif *notif);
47 const struct monitor *notif_monitor(const struct notif *notif);
48 
49 void notif_set_application(struct notif *notif, const char *text);
50 void notif_set_summary(struct notif *notif, const char *text);
51 void notif_set_body(struct notif *notif, const char *text);
52 void notif_set_urgency(struct notif *notif, enum urgency urgency);
53 void notif_set_image(struct notif *notif, pixman_image_t *pix);
54 void notif_set_timeout(struct notif *notif, int timeout_ms);
55 void notif_add_action(struct notif *notif, const char *id, const char *label);
56 void notif_play_sound(struct notif *notif);
57 
58 char *notif_get_summary(const struct notif *notif);
59 
60 typedef void (*notif_select_action_cb)(
61     uint32_t notif_id, const char *action_id, void *data);
62 
63 size_t notif_action_count(const struct notif *notif);
64 void notif_select_action(
65     const struct notif *notif, notif_select_action_cb completion_cb, void *data);
66