Skip to content

kitty image escapes corrupt output under tmux and screen #92

Description

@llimllib

--images kitty emits raw kitty graphics escapes with no check for a multiplexer. tmux requires graphics sequences to be wrapped in DCS passthrough, and screen doesn't support them at all, so running mdriver --images kitty inside either garbles the screen rather than degrading to alt text.

There's currently no terminal/environment detection anywhere in the codebase — the only env vars read are MDRIVER_THEME, MDRIVER_WIDTH and MDRIVER_PADDING (src/main.rs:292-303).

Minimum fix: if TMUX is set, or TERM starts with tmux or screen, disable image rendering and fall back to alt text. A warn\! explaining why would fit the existing logging setup.

Possible follow-on: accept --images auto as a third value that enables kitty only on positively-identified capable terminals, leaving the explicit --images kitty as a force. Unlike hyperlinks, image support is cheap to detect from the environment (KITTY_WINDOW_ID, GHOSTTY_RESOURCES_DIR, WEZTERM_PANE, TERM_PROGRAM, etc.) — pi's table in packages/tui/src/terminal-image.ts (detectCapabilitiesFromEnvironment) is a reasonable starting list.

Related: #87 (the same question for OSC8 hyperlinks).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions