Skip to content

Answer XTVERSION as ghostty when ghostel-term is xterm-ghostty - #801

Merged
dakra merged 1 commit into
mainfrom
feat/xtversion-ghostty
Nov 10, 2026
Merged

dakra merged 1 commit into
mainfrom
feat/xtversion-ghostty

Conversation

@dakra

@dakra dakra commented Nov 10, 2026

Copy link
Copy Markdown
Owner

libghostty-vt answers the XTVERSION query (CSI > q) with its default name libghostty. Programs that pick features from that name do not treat ghostel as Ghostty, whatever TERM and TERM_PROGRAM say. Claude Code draws kitty graphics images only for an accepted name (ghostty or kitty), so images in ghostel needed CLAUDE_CODE_FORCE_TERMINAL_IMAGES=1.

Ghostel now answers ghostty 1.4.0 when ghostel-term is xterm-ghostty, and libghostty otherwise.

Behaviour

  • Gate: the same condition under which TERM_PROGRAM=ghostty is exported. The ghostel-term docstring already promises that with another value nothing claims to be Ghostty.
  • Not tied to kitty graphics: the name is identity, not capability. A terminal with image storage disabled (text frame, ghostel-kitty-graphics-storage-limit 0) still leaves the graphics query unanswered, so Claude Code settles on no images there.
  • Remote spawns: the reply follows ghostel-term alone. The environment claim on a remote also depends on infocmp xterm-ghostty; the in-band reply cannot.
  • Version: ghostel--ghostty-version holds the version for both the reply and TERM_PROGRAM_VERSION, which moves from 1.3.2 to 1.4.0.

Implementation

ghostel--init-buffer passes the string to ghostel--new as a sixth optional argument, and the terminal keeps a copy for libghostty-vt's xtversion effect. The query can be answered on the PTY reader thread, where no Emacs state is reachable, so the value has to be fixed at creation.

Verification

  • New native test ghostel-test-xtversion-follows-ghostel-term checks both replies.
  • In a live ghostel buffer, printf '\033[>q' reads back ESC P > | ghostty 1.4.0 ESC \ by default and libghostty with ghostel-term set to xterm-256color.
  • Claude Code 2.1.322 with --debug-file and no force variable logs XTVERSION: terminal identified as "ghostty 1.4.0", then kittyGraphics=yes (probe: graphics reply OK, terminal ghostty 1.4.0) in a GUI frame and kittyGraphics=no (probe: no reply to the graphics query) in a text frame.

Not checked: Claude Code inside tmux, which decides from the name tmux recorded for the outer terminal.

libghostty-vt answered `CSI > q' with its default name `libghostty'.
Programs that pick features from the XTVERSION name did not treat
ghostel as Ghostty, whatever TERM and TERM_PROGRAM said.  Claude Code
draws kitty graphics images only for an accepted name, so images needed
CLAUDE_CODE_FORCE_TERMINAL_IMAGES=1.

Answer `ghostty <version>' when `ghostel-term' is "xterm-ghostty", the
condition under which TERM_PROGRAM=ghostty is exported, and keep
`libghostty' otherwise.  The reply does not depend on kitty graphics
being enabled: a terminal with image storage disabled still leaves the
graphics query unanswered.

`ghostel--init-buffer' passes the string to `ghostel--new' as a new
optional argument, since the query can be answered on the PTY reader
thread, where no Emacs state is reachable.

`ghostel--ghostty-version' holds the version for both the reply and
TERM_PROGRAM_VERSION, and moves it from 1.3.2 to 1.4.0.
@dakra
dakra merged commit 9e0f828 into main Nov 10, 2026
33 checks passed
@dakra
dakra deleted the feat/xtversion-ghostty branch November 10, 2026 15:36

This branch was previously deployed

1 inactive deployment
github-pages — 9e0f8286 Deployed Nov 10, 2026 by dakra via deploy #261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant