TerminalCapabilities constructor
Implementation
TerminalCapabilities({List<String>? env}) {
if (env != null) {
final environ = Environ(env);
final term = environ.getenv('TERM');
final termProg = environ.getenv('TERM_PROGRAM');
final lcTerm = environ.getenv('LC_TERMINAL');
// iTerm2 Image Protocol is specific to iTerm2-compatible terminals.
if (termProg.contains('iTerm') || lcTerm.contains('iTerm')) {
hasITerm2 = true;
}
// Kitty graphics is supported by Kitty itself and some other terminals
// (e.g. WezTerm). Treat TERM hints as "best effort" (queries are the
// source of truth).
if (term.contains('kitty') ||
term.contains('ghostty') ||
environ.getenv('KITTY_WINDOW_ID').isNotEmpty ||
termProg.contains('WezTerm') ||
termProg.toLowerCase().contains('ghostty') ||
lcTerm.toLowerCase().contains('ghostty')) {
hasKittyGraphics = true;
}
}
}