From e3548c206990f23caba4fa31fed1aaf3fceeb04f Mon Sep 17 00:00:00 2001 From: Wez Furlong <wez@wezfurlong.org> Date: Sat, 3 Sep 2022 08:15:03 -0700 Subject: [PATCH] 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. --- util/helper-cairo.hh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh index 5fbaf9e41..6df92e560 100644 --- a/util/helper-cairo.hh +++ b/util/helper-cairo.hh @@ -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")) {