From c7972229305cfa76d402507a852af321198fdd2c Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 25 Jul 2024 18:47:23 +0200 Subject: 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. --- notify.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'notify.c') 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; -- cgit v1.3