Skip to content

feat(terminal): honour transparent and blurred window backgrounds - #124

Merged
remorses merged 1 commit into
mainfrom
claude/terminal-transparent-background
Oct 31, 2026
Merged

remorses merged 1 commit into
mainfrom
claude/terminal-transparent-background

Conversation

@remorses

Copy link
Copy Markdown
Owner

Terminal mode now respects windowBackground: 'transparent' | 'blurred', so a terminal that has its own background opacity and blur shows the user's blurred wallpaper behind a GPUIX app.

render(<App />, { terminal: true, windowBackground: 'blurred' })
# kitty.conf                  # ghostty
background_opacity 0.6        background-opacity = 0.6
background_blur 32            background-blur = true

What changed

packages/gpui-terminal/src/window.rs only, plus README and a changeset.

  • TerminalWindow used to return Opaque from background_appearance() and ignore set_background_appearance(). GPUI calls the setter right after it opens the window, so the window now stores the appearance and passes it to its renderer.
  • Transparent / Blurred
    • Headless Metal clears to transparent through GPUI's existing update_transparency.
    • GPUI blends onto a transparent clear, so the pixels it reads back are premultiplied. kitty's f=32 takes straight sRGB RGBA, so unpremultiply converts each frame before it is presented.
  • Opaque (bug fix on Linux): the wgpu offscreen target always clears to transparent, so opaque windows leaked alpha there. Alpha is now forced to 255. The colour is already the scene composited over black, which matches a native opaque window.

No GPUI change was needed. The fix is in GPUIX's own gpui_terminal crate.

Blur is the terminal's job

The kitty graphics protocol, kitty's OSC codes and Ghostty have no escape code that lets an app set opacity or blur. kitty can change opacity at runtime only through remote control or a shortcut, with dynamic_background_opacity. So in a terminal blurred behaves the same as transparent, and the blur comes from the terminal's background_blur / background-blur. The README says so, and also notes that the protocol only promises alpha blending with the cells under the image. kitty applies background_opacity only to cells with the default background colour.

Verification

On Linux (wgpu on lavapipe), in a pty, I decoded the first inline frame of a scene with the left half at 50% white and the right half unpainted:

left (50% white) right (unpainted)
before, any mode 128,128,128,128 (too dark) 0,0,0,0
after, blurred 255,255,255,128 0,0,0,0
after, opaque 128,128,128,255 0,0,0,255
  • cargo test in packages/gpui-terminal passes (adds unpremultiply tests), and cargo test --lib in packages/native passes (285).
  • Not tested: the macOS Metal path (it compiles only on macOS; CI builds it), and the result in a real kitty or Ghostty window with blur turned on.

Harness: Claude Code
Agent: none
Model: not written here; this harness does not put model ids in PR bodies

User prompts
  1. review opened prs in last week. review them. find if they are worth merging. and align with this project philosophy and work. if some need changes appy changes and simplify. then merge to main. if they need changes or simplification apply them. if required apply changes to make testse passs in linux, etc

  2. yes

  3. see also now that we support blurring background for gpuix apps. can we support this also in terminal mode? for terminals that support blurred background themselves as well? so that we can see the backkground wallpaper of the user also via terminal. read if possible via the kitty graphics api. do this in another pr.


Generated by Claude Code

Terminal mode ignored windowBackground: the terminal window always reported
Opaque and dropped set_background_appearance. GPUI calls that right after
opening a window, so the terminal window now stores the appearance and tells
its renderer.

- Transparent/Blurred: headless Metal clears to transparent
  (update_transparency), and each frame is converted from GPUI's premultiplied
  colour to the straight RGBA that kitty's f=32 images take. Before, 50% white
  reached the terminal as (128,128,128,128), a dark gray.
- Opaque: the wgpu offscreen target always clears to transparent, so on Linux
  an opaque window leaked alpha. Its alpha is now forced to 255; the colour is
  already the scene over black, like a native opaque window.

No escape code lets an app set a terminal's opacity or blur, so Blurred means
the same as Transparent: a terminal configured with kitty background_blur or
Ghostty background-blur shows the blurred wallpaper through the clear pixels.
README documents the setup and the limits.

Checked on Linux (wgpu, lavapipe) by decoding the first inline frame from a pty:
blurred sends (255,255,255,128) for 50% white and (0,0,0,0) where unpainted;
opaque sends (128,128,128,255) and (0,0,0,255).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKVVkQhECMpqEZFEdCGjhc
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T15:32:44.751153Z f6c9c01 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@remorses
remorses merged commit b6f00c9 into main Oct 31, 2026
9 checks passed
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.

2 participants