aboutsummaryrefslogtreecommitdiff
path: root/osc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-08-04 13:21:06 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-08-04 13:23:31 +0000
commit84d36606cbd3e35aae6a68e69101b22da60dbe99 (patch)
treef7f8cb0d87ad7a5cf53ce6fd39612ce0fa5aa3b9 /osc.c
parentosc: kitty notifications: implement s=silent (diff)
osc: kitty notifications: add support for XDG sound names
Diffstat (limited to 'osc.c')
-rw-r--r--osc.c11
1 files changed, 10 insertions, 1 deletions
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 */