aboutsummaryrefslogtreecommitdiff
path: root/notify.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-25 16:47:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-25 16:47:23 +0000
commitc7972229305cfa76d402507a852af321198fdd2c (patch)
tree2ef358c34570e9b029d98b8d8a39a8d50e0a4e2c /notify.c
parentnotify: rename 'report' -> 'report_activated' (diff)
osc: kitty notification: implement 'close' events
Application can now request to receive a 'close' event when the notification is closed (but not necessarily activated), by adding 'c=1' to the notification request.
Diffstat (limited to 'notify.c')
-rw-r--r--notify.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/notify.c b/notify.c
index 60b2bced..68ba83f3 100644
--- a/notify.c
+++ b/notify.c
@@ -181,7 +181,7 @@ notif_done(struct reaper *reaper, pid_t pid, int status, void *data)
if (notif->activated && notif->report_activated) {
xassert(notif->id != NULL);
- LOG_DBG("sending notification report to client");
+ LOG_DBG("sending notification activation event to client");
char reply[7 + strlen(notif->id) + 1 + 2 + 1];
int n = xsnprintf(
@@ -189,6 +189,15 @@ notif_done(struct reaper *reaper, pid_t pid, int status, void *data)
term_to_slave(term, reply, n);
}
+ if (notif->report_closed) {
+ LOG_DBG("sending notification close event to client");
+
+ char reply[7 + strlen(notif->id) + 1 + 7 + 1 + 2 + 1];
+ int n = xsnprintf(
+ reply, sizeof(reply), "\033]99;i=%s:p=close;\033\\", notif->id);
+ term_to_slave(term, reply, n);
+ }
+
notify_free(term, notif);
tll_remove(term->active_notifications, it);
return;