Skip to content

Native host fixes: Kitty identity, first-run studio, trails that draw and reload, distinct trail previews - #525

Draft
raiseCatError wants to merge 5 commits into
feature/appearance-integration-20261029from
fix/native-host-shaders-20261029
Draft

raiseCatError wants to merge 5 commits into
feature/appearance-integration-20261029from
fix/native-host-shaders-20261029

Conversation

@raiseCatError

Copy link
Copy Markdown
Owner

Stacked on #522 (feature/appearance-integration-20261029). Refs #399.

Fixes Kitty Host Native not working and Lightning looking the same as Blaze. Each root cause was reproduced in a real Kitty 0.49.2 window first.

Root causes and fixes

  1. Kitty detected as Ghostty. Kitty passes an inherited TERM_PROGRAM through unchanged: a Kitty started from a Ghostty shell has TERM=xterm-kitty, KITTY_WINDOW_ID=1 and TERM_PROGRAM=ghostty. terminalProfile() let TERM_PROGRAM win, so /appearance offered Ghostty's studio inside Kitty. Now a terminal-specific TERM wins. Cursor facts and detectTerminalHost() use the same identity, and tmux keeps its previous outer-host behavior.
  2. First run went to the old setup. /cursor › Host native opened the Kitty studio only when the older /cursor include already existed. Kitty 0.49+ now goes straight to the studio. Kitty below 0.49 keeps the built-in cursor_trail setup.
  3. A written trail was never drawn. Kitty draws trail shaders only while cursor_trail > 0. With /cursor Motion Off (or Kitty's default) it is 0. NMSh's own fragment now sets cursor_trail 3 when needed. This is judged without NMSh's own line, so syncs keep it. A later line that forces 0 refuses. Confirming a trail sets Motion Off → Tail and Portable → Auto, and the review shows both changes.
  4. Switching presets never loaded. Kitty watches only kitty.conf, not included files. Lightning → Blaze rewrites only NMSh's pipeline, so Kitty kept drawing Lightning, and the guidance wrongly said it reloads automatically. After a write, removal or gate sync, NMSh now sends Kitty's documented reload signal (SIGUSR1). It sends it only to KITTY_PID, and only when that process is one of NMSh's parents and is kitty. Otherwise it shows the reload keys. The review says this before anything is written.
  5. Same preview for every trail. Studio previews drew one shared trail shape that differed only in color, so Lightning (peach/red) looked like Blaze (amber/red). Blaze, Lightning, Motion blur and Comet now each draw their own shape.
  6. Frozen cursor with Host native before setup. Choosing Host native in Ghostty or Kitty before setup made Portable draw nothing, so the cursor looked frozen. Portable now draws until setup, labelled as a fallback.

The emitted pipelines already referenced the correct shipped shader. A regression test pins this.

Verification

  • Related focused tests: 180/180 (the repo runner with private HOME). tsc is clean. The 7 new or changed regressions fail on the original source.
  • Physical Kitty 0.49.2 (disposable config, build ebe54eb):
    • The studio is offered, and the first-run Host native route reaches it.
    • GPU output: Lightning draws an electric bolt with forks; Blaze draws an amber flame band.
    • Switching through NMSh alone loaded the right effect 4/4 times in two cycles. One earlier miss out of 7, on a freshly launched Kitty, did not recur.
    • Blaze + Northern Lights + CRT were all visible, with one trail.
    • R restored kitty.conf byte for byte.
  • Ghostty 1.3.1: NMSh-generated Comet + Aurora render in an isolated instance.
  • NOT RUN physically: the NMSh-driven Ghostty write, Portable switch and removal. On macOS, Ghostty always reads the real config, and NMSh refuses --config-file launches. Private-HOME tests cover them.
  • Physical QA notes and screenshots: docs/development/native-appearance-welcome/TEST_RESULTS.md.

… that draws, distinct trail previews

- terminalProfile: a terminal-specific TERM (xterm-kitty, xterm-ghostty) wins over an inherited
  TERM_PROGRAM. Kitty passes the outer TERM_PROGRAM through (Kitty 0.49.2 started from Ghostty:
  TERM=xterm-kitty, KITTY_WINDOW_ID=1, TERM_PROGRAM=ghostty), so NMSh showed Ghostty's studio in
  Kitty. Cursor host facts and detectTerminalHost now use the same identity (tmux keeps the outer
  host's markers as before).
- /cursor > Host native in Kitty 0.49+ opens the Kitty shader studio on first use too, instead of
  the older include setup; Kitty below 0.49 keeps the built-in cursor_trail setup.
- A Kitty trail shader draws only while cursor_trail > 0. NMSh's own fragment now turns it on when
  it would be 0 (judged without NMSh's own line, so sync keeps it), refuses when a later line forces
  0, and the review says so. Confirming a trail sets /cursor Motion Off -> Tail and Portable -> Auto
  (disclosed in the review); Motion Off later removes NMSh's trail like a Portable renderer.
- Previews: Blaze, Lightning, Motion blur and Comet each draw their own shape. All trails shared one
  preview that differed only in color, so Lightning looked like Blaze. The emitted pipelines already
  referenced the right shipped shader (regression added).
…ead of a motionless cursor

With Renderer = Host native in Ghostty or Kitty and nothing native set up yet, no GPU trail
exists, but Portable was told to draw nothing, so the cursor looked frozen. Portable now draws
until setup, labelled 'Portable fallback · <host> native is not set up yet', and the /cursor rows
say 'Portable until <host> setup'. A host with no native effects at all keeps the existing
'Host native is not available' state.
…r say how

Kitty watches only kitty.conf, not the files it includes. Switching Lightning to Blaze rewrites
only NMSh's pipeline file, so Kitty kept drawing the previous effect until a manual reload; the
guidance wrongly said Kitty reloads automatically. Observed in Kitty 0.49.2: Lightning written,
Blaze still drawn; after SIGUSR1, Lightning drawn.

After a confirmed write, a removal or a gate sync, NMSh now sends Kitty's documented reload signal
(SIGUSR1) to KITTY_PID only when that process is one of NMSh's own parents and its program is
kitty; otherwise it gives the reload keys. The review discloses this before anything is written.
…heck, tmux Kitty fallback order

- Confirming a Kitty review refuses when the /cursor changes it showed are no longer the ones that
  would apply (Motion or renderer changed meanwhile); under Reduced Motion or Effects Off a trail
  is not written, so /cursor is left alone.
- A second Enter on /cursor > Host native setup while Kitty's catalog is read does nothing.
- detectTerminalHost: the tmux fallback (KITTY_WINDOW_ID without a profile) returns to its old place
  after the hosts TERM_PROGRAM names, so a stale KITTY_WINDOW_ID does not outrank Terminal.app.

This branch has not been deployed

No deployments
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