Skip to content

Commit

Permalink
ChafaTermDb: Support WezTerm detection based on WEZTERM_EXECUTABLE
Browse files Browse the repository at this point in the history
This allows WezTerm detection inside tmux, which overrides
TERM_PROGRAM.

Ref: #217 (GitHub).
  • Loading branch information
hpjansson committed Sep 18, 2024
1 parent 258bc77 commit cabd61d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion chafa/chafa-term-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ detect_capabilities (ChafaTermInfo *ti, gchar **envp)
const gchar *nvim;
const gchar *nvim_tui_enable_true_color;
const gchar *eat_shell_integration_dir;
const gchar *wezterm_executable;
gchar *comspec = NULL;
const SeqStr **color_seq_list = color_256_list;
const SeqStr *gfx_seqs = NULL;
Expand All @@ -424,6 +425,7 @@ detect_capabilities (ChafaTermInfo *ti, gchar **envp)
nvim = getenv_or_blank (envp, "NVIM");
nvim_tui_enable_true_color = getenv_or_blank (envp, "NVIM_TUI_ENABLE_TRUE_COLOR");
eat_shell_integration_dir = getenv_or_blank (envp, "EAT_SHELL_INTEGRATION_DIR");
wezterm_executable = getenv_or_blank (envp, "WEZTERM_EXECUTABLE");

/* The MS Windows 10 TH2 (v1511+) console supports ANSI escape codes,
* including AIX and DirectColor sequences. We detect this early and allow
Expand Down Expand Up @@ -496,7 +498,8 @@ detect_capabilities (ChafaTermInfo *ti, gchar **envp)
gfx_seqs = iterm2_seqs;
}

if (!g_ascii_strcasecmp (term_program, "WezTerm"))
if (!g_ascii_strcasecmp (term_program, "WezTerm")
|| strlen (wezterm_executable) > 0)
{
gfx_seqs = sixel_seqs;
}
Expand Down

0 comments on commit cabd61d

Please sign in to comment.