mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-28 07:58:00 -04:00
osc: kitty notifications: implement s=silent
This implements part of the new 's' (sound) parameter; the 'silent'
value. When s=silent, we set the ${muted} template argument to
"true". It is intended to set the 'suppress-sound' hint:
notify-send --hint BOOLEAN:suppress-sound:${muted}
This commit is contained in:
parent
a3a35f2c8c
commit
6349262491
6 changed files with 43 additions and 11 deletions
29
osc.c
29
osc.c
|
|
@ -609,6 +609,7 @@ kitty_notification(struct terminal *term, char *string)
|
|||
char *icon_cache_id = NULL; /* The 'g' parameter */
|
||||
char *symbolic_icon = NULL; /* The 'n' parameter */
|
||||
char *category = NULL; /* The 't' parameter */
|
||||
char *sound_name = NULL; /* The 's' parameter */
|
||||
char *payload = NULL;
|
||||
|
||||
bool focus = true; /* The 'a' parameter */
|
||||
|
|
@ -739,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",
|
||||
"\033]99;i=%s:p=?;p=%s:a=%s:o=%s:u=%s:c=1:w=1:s=silent%s",
|
||||
reply_id, p_caps, a_caps, when_caps, u_caps, terminator);
|
||||
|
||||
xassert(n < sizeof(reply));
|
||||
|
|
@ -783,10 +784,15 @@ kitty_notification(struct terminal *term, char *string)
|
|||
break;
|
||||
}
|
||||
|
||||
case 'f':
|
||||
free(app_id);
|
||||
app_id = base64_decode(value, NULL);
|
||||
case 'f': {
|
||||
/* App-name */
|
||||
char *decoded = base64_decode(value, NULL);
|
||||
if (decoded != NULL) {
|
||||
free(app_id);
|
||||
app_id = decoded;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 't': {
|
||||
/* Type (category) */
|
||||
|
|
@ -805,6 +811,16 @@ kitty_notification(struct terminal *term, char *string)
|
|||
break;
|
||||
}
|
||||
|
||||
case 's': {
|
||||
/* Sound */
|
||||
char *decoded = base64_decode(value, NULL);
|
||||
if (decoded != NULL) {
|
||||
free(sound_name);
|
||||
sound_name = decoded;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'g':
|
||||
/* graphical ID (see 'n' and 'p=icon') */
|
||||
free(icon_cache_id);
|
||||
|
|
@ -946,6 +962,10 @@ kitty_notification(struct terminal *term, char *string)
|
|||
}
|
||||
}
|
||||
|
||||
if (sound_name != NULL) {
|
||||
notif->muted = streq(sound_name, "silent");
|
||||
}
|
||||
|
||||
/* Handled chunked payload - append to existing metadata */
|
||||
switch (payload_type) {
|
||||
case PAYLOAD_TITLE:
|
||||
|
|
@ -1067,6 +1087,7 @@ out:
|
|||
free(symbolic_icon);
|
||||
free(payload);
|
||||
free(category);
|
||||
free(sound_name);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue