From b0bf8ca5f7034f6d95bc3b58082e719a81d99859 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 19 Jul 2024 15:04:28 +0200 Subject: osc/notify: add support for OSC-99, kitty desktop notifications This adds limited support for OSC-99, kitty desktop notifications[^1]. We support everything defined by the "protocol", except: * 'a': action to perform on notification activation. Since we don't trigger the notification ourselves (over D-Bus), we don't know a) which ID the notification got, or b) when it is clicked. * ... and that's it. Everything else is supported To be explicit, we *do* support: * Chunked notifications (d=0|1), allowing the application to append data to a notification in chunks, before it's finally displayed. * Plain UTF-8, or base64-encoded UTF-8 payload (e=0|1). * Notification identifier (i=xyz). * Payload type (p=title|body). * When to honor the notification (o=always|unfocused|invisible), with the following quirks: - we don't know when the window is invisible, thus it's treated as 'unfocused'. - the foot option 'notify-focus-inhibit' overrides 'always' * Urgency (u=0|1|2) [^1]: https://sw.kovidgoyal.net/kitty/desktop-notifications/ --- pgo/pgo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pgo') diff --git a/pgo/pgo.c b/pgo/pgo.c index 204c024d..e8080521 100644 --- a/pgo/pgo.c +++ b/pgo/pgo.c @@ -152,7 +152,9 @@ void ime_disable(struct seat *seat) {} void ime_reset_preedit(struct seat *seat) {} void -notify_notify(const struct terminal *term, const char *title, const char *body) + notify_notify( + const struct terminal *term, const char *title, const char *body, + enum notify_when when, enum notify_urgency urgency) { } -- cgit v1.3 From 7268ee9078e8c0ce4b7cdaa479b67ea34aa8e88f Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 23 Jul 2024 07:43:42 +0200 Subject: pgo: update spawn() prototype --- pgo/pgo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pgo') diff --git a/pgo/pgo.c b/pgo/pgo.c index e8080521..7aabebb4 100644 --- a/pgo/pgo.c +++ b/pgo/pgo.c @@ -100,12 +100,12 @@ void wayl_win_alpha_changed(struct wl_window *win) {} bool wayl_win_set_urgent(struct wl_window *win) { return true; } bool wayl_fractional_scaling(const struct wayland *wayl) { return true; } -bool +pid_t spawn(struct reaper *reaper, const char *cwd, char *const argv[], int stdin_fd, int stdout_fd, int stderr_fd, - const char *xdg_activation_token) + reaper_cb cb, void *cb_data, const char *xdg_activation_token) { - return true; + return 2; } pid_t -- cgit v1.3 From e88ec86c9337b0a2e1b9d3d1d207005a4c084a79 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 23 Jul 2024 07:43:56 +0200 Subject: pgo: update notify_notify() prototype, add notify_free() --- pgo/pgo.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'pgo') diff --git a/pgo/pgo.c b/pgo/pgo.c index 7aabebb4..6c13b72a 100644 --- a/pgo/pgo.c +++ b/pgo/pgo.c @@ -151,13 +151,18 @@ void ime_enable(struct seat *seat) {} void ime_disable(struct seat *seat) {} void ime_reset_preedit(struct seat *seat) {} +bool +notify_notify(const struct terminal *term, struct notification *notif) +{ + return true; +} + void - notify_notify( - const struct terminal *term, const char *title, const char *body, - enum notify_when when, enum notify_urgency urgency) +notify_free(struct terminal *term, struct notification *notif) { } + void reaper_add(struct reaper *reaper, pid_t pid, reaper_cb cb, void *cb_data) {} void reaper_del(struct reaper *reaper, pid_t pid) {} -- cgit v1.3 From 50efd9726d041b00d3966431b8e6957a3739b33c Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 23 Jul 2024 12:15:37 +0200 Subject: pgo: updated stubs for notification functions --- pgo/pgo.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'pgo') diff --git a/pgo/pgo.c b/pgo/pgo.c index 6c13b72a..6dc0dd10 100644 --- a/pgo/pgo.c +++ b/pgo/pgo.c @@ -152,7 +152,7 @@ void ime_disable(struct seat *seat) {} void ime_reset_preedit(struct seat *seat) {} bool -notify_notify(const struct terminal *term, struct notification *notif) +notify_notify(struct terminal *term, struct notification *notif) { return true; } @@ -162,6 +162,22 @@ notify_free(struct terminal *term, struct notification *notif) { } +void +notify_icon_add(struct terminal *term, const char *id, + const char *symbolic_name, const uint8_t *data, + size_t data_sz) +{ +} + +void +notify_icon_del(struct terminal *term, const char *id) +{ +} + +void +notify_icon_free(struct notification_icon *icon) +{ +} void reaper_add(struct reaper *reaper, pid_t pid, reaper_cb cb, void *cb_data) {} void reaper_del(struct reaper *reaper, pid_t pid) {} -- cgit v1.3