From ee9c76ded00de9beac698d2bd4771e8c1d966c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 9 Aug 2024 08:25:36 +0200 Subject: [PATCH] osc: kitty: update 's' to the latest spec * The spec now defines a couple of "standard" names. Translate these to the freedesktop compliant names. * The query response no longer contains 'xdg-names', but instead list the supported standard names. --- osc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osc.c b/osc.c index eba1850f..53597d0f 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,xdg-names%s", + "\033]99;i=%s:p=?;p=%s:a=%s:o=%s:u=%s:c=1:w=1:s=system,silent,error,warn,warning,info,question%s", reply_id, p_caps, a_caps, when_caps, u_caps, terminator); xassert(n < sizeof(reply)); @@ -817,6 +817,22 @@ kitty_notification(struct terminal *term, char *string) if (decoded != NULL) { free(sound_name); sound_name = decoded; + + const char *translated_name = NULL; + + if (streq(decoded, "error")) + translated_name = "dialog-error"; + else if (streq(decoded, "warn") || streq(decoded, "warning")) + translated_name = "dialog-warning"; + else if (streq(decoded, "info")) + translated_name = "dialog-information"; + else if (streq(decoded, "question")) + translated_name = "dialog-question"; + + if (translated_name != NULL) { + free(sound_name); + sound_name = xstrdup(translated_name); + } } break; }