add PI_NO_IMAGES env var to disable inline image rendering

This commit is contained in:
Nico Bailon 2025-12-12 19:35:54 -08:00
parent 9e9d5c94ed
commit f603a377ae
2 changed files with 62 additions and 0 deletions

View file

@ -28,6 +28,12 @@ export function detectCapabilities(): TerminalCapabilities {
const termProgram = process.env.TERM_PROGRAM?.toLowerCase() || "";
const term = process.env.TERM?.toLowerCase() || "";
const colorTerm = process.env.COLORTERM?.toLowerCase() || "";
const disableImages = process.env.PI_NO_IMAGES === "1" || process.env.PI_NO_IMAGES === "true";
if (disableImages) {
const trueColor = colorTerm === "truecolor" || colorTerm === "24bit";
return { images: null, trueColor, hyperlinks: true };
}
if (process.env.KITTY_WINDOW_ID || termProgram === "kitty") {
return { images: "kitty", trueColor: true, hyperlinks: true };