hb-view: Detect WezTerm and use iterm2 image protocol

Similar to the logic that detects iterm2, but look for
TERM_PROGRAM=WezTerm which identifies wezterm is present.

This allows hb-view to output an image directly to the terminal.
This commit is contained in:
Wez Furlong 2022-09-03 08:15:03 -07:00 committed by GitHub
parent 238e7dd2b6
commit e3548c2069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -410,6 +410,12 @@ helper_cairo_create_context (double w, double h,
extension = "png";
protocol = image_protocol_t::ITERM2;
}
else if ((name = getenv ("TERM_PROGRAM")) != nullptr &&
0 == g_ascii_strcasecmp (name, "WezTerm"))
{
extension = "png";
protocol = image_protocol_t::ITERM2;
}
else if ((name = getenv ("TERM")) != nullptr &&
0 == g_ascii_strcasecmp (name, "xterm-kitty"))
{