diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2024-08-04 13:21:06 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2024-08-04 13:23:31 +0000 |
| commit | 84d36606cbd3e35aae6a68e69101b22da60dbe99 (patch) | |
| tree | f7f8cb0d87ad7a5cf53ce6fd39612ce0fa5aa3b9 /osc.c | |
| parent | osc: kitty notifications: implement s=silent (diff) | |
osc: kitty notifications: add support for XDG sound names
Diffstat (limited to 'osc.c')
| -rw-r--r-- | osc.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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 */ |
