Add support for the kitty graphics protocol

Kitty-capable terminals (kitty, ghostty, and others) can display
inline images via APC escape sequences.

Kitty's image support uses a passthrough model: APC sequences from
programs running inside panes are relayed verbatim to the outer
terminal with cursor positioning adjusted for the pane offset.

The outer terminal handles all image rendering and therefore itself must
be kitty-aware.
This commit is contained in:
Thomas Adam
2026-02-28 21:14:32 +00:00
parent d9d2b2f1ee
commit cf6cbe430c
11 changed files with 608 additions and 2 deletions

View File

@@ -2571,6 +2571,17 @@ format_cb_sixel_support(__unused struct format_tree *ft)
#endif
}
/* Callback for kitty_support. */
static void *
format_cb_kitty_support(__unused struct format_tree *ft)
{
#ifdef ENABLE_KITTY
return (xstrdup("1"));
#else
return (xstrdup("0"));
#endif
}
/* Callback for active_window_index. */
static void *
format_cb_active_window_index(struct format_tree *ft)
@@ -3469,6 +3480,9 @@ static const struct format_table_entry format_table[] = {
{ "sixel_support", FORMAT_TABLE_STRING,
format_cb_sixel_support
},
{ "kitty_support", FORMAT_TABLE_STRING,
format_cb_kitty_support
},
{ "socket_path", FORMAT_TABLE_STRING,
format_cb_socket_path
},