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.
This commit is contained in:
Daniel Eklöf 2024-08-09 08:25:36 +02:00
parent 481ce82d66
commit ee9c76ded0
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

18
osc.c
View file

@ -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;
}