format: add image_support

This adds a new image_support format which returns:

   "sixel" -- if sixel is compiled in
   "kitty" -- if kitty is compiled in
   "kitty,sixel" -- if compiled with both kitty and sixel
This commit is contained in:
Thomas Adam
2026-03-02 16:34:36 +00:00
parent cf6cbe430c
commit 3b7e9fb175
2 changed files with 15 additions and 21 deletions

View File

@@ -2562,24 +2562,21 @@ format_cb_version(__unused struct format_tree *ft)
/* Callback for sixel_support. */
static void *
format_cb_sixel_support(__unused struct format_tree *ft)
format_cb_image_support(__unused struct format_tree *ft)
{
#ifdef ENABLE_SIXEL
return (xstrdup("1"));
#else
return (xstrdup("0"));
#if defined(ENABLE_SIXEL) && defined(ENABLE_KITTY)
return (xstrdup("kitty,sixel"));
#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"));
#ifdef ENABLE_SIXEL
return (xstrdup("sixel"));
#endif
#ifdef ENABLE_KITTY
return (xstrdup("kitty"));
#endif
return (NULL);
}
/* Callback for active_window_index. */
@@ -3201,6 +3198,9 @@ static const struct format_table_entry format_table[] = {
{ "host_short", FORMAT_TABLE_STRING,
format_cb_host_short
},
{ "image_support", FORMAT_TABLE_STRING,
format_cb_image_support
},
{ "insert_flag", FORMAT_TABLE_STRING,
format_cb_insert_flag
},
@@ -3477,12 +3477,6 @@ static const struct format_table_entry format_table[] = {
{ "session_windows", FORMAT_TABLE_STRING,
format_cb_session_windows
},
{ "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
},