From 84d36606cbd3e35aae6a68e69101b22da60dbe99 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 4 Aug 2024 15:21:06 +0200 Subject: osc: kitty notifications: add support for XDG sound names --- osc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'osc.c') diff --git a/osc.c b/osc.c index 50415570..eba1850f 100644 --- a/osc.c +++ b/osc.c @@ -740,7 +740,7 @@ kitty_notification(struct terminal *term, char *string) char reply[128]; int n = xsnprintf( reply, sizeof(reply), - "\033]99;i=%s:p=?;p=%s:a=%s:o=%s:u=%s:c=1:w=1:s=silent%s", + "\033]99;i=%s:p=?;p=%s:a=%s:o=%s:u=%s:c=1:w=1:s=silent,xdg-names%s", reply_id, p_caps, a_caps, when_caps, u_caps, terminator); xassert(n < sizeof(reply)); @@ -964,6 +964,15 @@ kitty_notification(struct terminal *term, char *string) if (sound_name != NULL) { notif->muted = streq(sound_name, "silent"); + + if (notif->muted || streq(sound_name, "system")) { + free(notif->sound_name); + notif->sound_name = NULL; + } else { + free(notif->sound_name); + notif->sound_name = sound_name; + sound_name = NULL; /* Prevent double free */ + } } /* Handled chunked payload - append to existing metadata */ -- cgit v1.3