aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-23 09:29:05 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-23 09:29:05 +0000
commitccb184ae645cd92a6e3aba429ab88a94a09bbf8c (patch)
tree881797b5589ff9fbb7588b24791014ab01813fad /terminal.c
parentnotify: stdout is a bad name (diff)
osc: kitty notifications: updated support for icons
This implements the suggested protocol discussed in https://github.com/kovidgoyal/kitty/issues/7657. Icons are handled by loading a cache. Both in-band PNG data, and symbolic names are allowed. Applications use a graphical ID to reference the icon both when loading the cache, and when showing a notification. * 'g' is the graphical ID * 'n' is optional, and assigns a symbolic name to the icon * 'p=icon' - the payload is icon PNG data. It needs to be base64 encoded, but this is *not* implied. I.e. the application *must* use e=1 explicitly. To load an icon (in-band PNG data): printf '\e]99;g=123:p=icon;<base64-encoded-png-data>\e\\' or (symbolic name) printf '\e]99;g=123:n=firefox:p=icon;\e\\' Of course, we can combine the two, assigning *both* a symbolic name, *and* PNG data: printf '\e]99;g=123:n=firefox:p=icon;<base64-encoded-png>\e\\' Then, to use the icon in a notification: printf '\e]99;g=123;this is a notification\e\\' Foot also allows a *symbolic* icon to be defined and used at the same time: printf '\e]99;g=123:n=firefox;this is a notification\e\\' This obviously won't work with PNG data, since it uses the payload portion of the escape sequence.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/terminal.c b/terminal.c
index a0be4518..eadb9dbc 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1823,6 +1823,9 @@ term_destroy(struct terminal *term)
tll_remove(term->notifications, it);
}
+ for (size_t i = 0; i < ALEN(term->notification_icons); i++)
+ notify_icon_free(&term->notification_icons[i]);
+
sixel_fini(term);
term_ime_reset(term);
@@ -2033,6 +2036,9 @@ term_reset(struct terminal *term, bool hard)
tll_remove(term->notifications, it);
}
+ for (size_t i = 0; i < ALEN(term->notification_icons); i++)
+ notify_icon_free(&term->notification_icons[i]);
+
term->grapheme_shaping = term->conf->tweak.grapheme_shaping;
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED