Skip to content

Fix transparent terminal backgrounds - #5425

Closed
TomBonness wants to merge 1 commit into
stablyai:mainfrom
TomBonness:fix-terminal-transparency-blur-scrollbar
Closed

TomBonness wants to merge 1 commit into
stablyai:mainfrom
TomBonness:fix-terminal-transparency-blur-scrollbar

Conversation

@TomBonness

@TomBonness TomBonness commented Jun 15, 2026 •

Copy link
Copy Markdown

Summary

  • Keep macOS blurred Orca windows transparent when inactive by using an active vibrancy effect and transparent BrowserWindow background.
  • Let the native window material show through by making the renderer body transparent.
  • Avoid translucent terminal repaint flashes and invisible cursor/selection feedback by keeping auto-mode transparent terminals on xterm's DOM renderer instead of WebGL.
  • Hide the native xterm viewport scrollbar paint and tint the xterm scrollbar thumb so transparent terminals do not show a bright white line.

Screenshots

Manual local verification in the packaged app showed the terminal remaining transparent while unfocused, no white scrollbar line after restart, and the cursor visible again after transparent terminals used the DOM renderer. No screenshot committed to the PR.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Focused checks run:

  • pnpm exec oxfmt --write src/main/window/createMainWindow.ts src/main/window/createMainWindow.test.ts src/renderer/src/assets/main.css src/renderer/src/assets/terminal.css src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • pnpm exec vitest run --config config/vitest.config.ts src/main/window/createMainWindow.test.ts src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts src/renderer/src/lib/pane-manager/pane-terminal-gpu-acceleration.test.ts
  • pnpm exec tsgo --noEmit -p config/tsconfig.node.json
  • pnpm exec tsgo --noEmit -p config/tsconfig.tc.web.json
  • pnpm exec node config/scripts/check-styled-scrollbars.mjs
  • pnpm exec oxlint src/main/window/createMainWindow.ts src/main/window/createMainWindow.test.ts src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • Follow-up after cursor/selection regression: pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • Follow-up after cursor/selection regression: pnpm exec oxlint src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts

AI Review Report

AI review checked the Electron window flags, renderer transparency path, xterm renderer selection, scrollbar styling, and platform-specific behavior. Main risks checked:

  • macOS: inactive windows must keep the vibrancy material active; transparent BrowserWindow background must only apply when blur is enabled.
  • Windows: acrylic path remains unchanged.
  • Linux: no native blur path is added; default opaque BrowserWindow background remains unchanged.
  • Terminal rendering: WebGL remains available when users force it on, but auto-mode transparent terminals use DOM rendering to avoid opaque WebGL background repaints and keep cursor/selection feedback visible.
  • Scrollbars: CSS hides only xterm viewport native scrollbar paint and keeps xterm's custom slider visible with a translucent thumb.

No blocker found in the reviewed diff.

Security Audit

No new IPC, file access, auth, shell command, path handling, network, or secrets behavior. Changes are limited to Electron window construction options, renderer CSS, and local xterm renderer selection. No follow-up security work needed.

Notes

This intentionally trades WebGL acceleration for visual correctness only when terminal transparency is enabled and GPU acceleration is set to auto. Users who explicitly set GPU acceleration to on still get WebGL.

ELI5

Transparent/blurred terminals looked wrong: inactive windows lost transparency, cursors and selections could vanish, and repaints flashed. Fixes keep blur and transparency working smoothly on macOS.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

createMainWindow is updated to set backgroundColor: '#00000000', transparent: true, vibrancy: 'under-window', and visualEffectState: 'active' when macOS blur is enabled, falling back to theme-based colors otherwise. The renderer's body rule in main.css switches from a Tailwind background token to background-color: transparent. Terminal scrollbar CSS is expanded to hide native scrollbar chrome across Firefox and WebKit and to apply a transparent background to the xterm DOM scrollbar container. shouldUseTerminalWebgl gains an early guard that forces the DOM renderer when allowTransparency is set and GPU acceleration is not explicitly 'on'. Tests are added for both the new macOS blur window options and the transparency/WebGL interaction.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix transparent terminal backgrounds' directly summarizes the main objective of the changeset, which addresses visual transparency issues across multiple components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description follows the required template and includes the needed summary, screenshots, testing, AI review, security, and notes sections.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7a49dd49-8ec8-4261-8c64-36d02115edce

📥 Commits

Reviewing files that changed from the base of the PR and between f3f41e3 and d3e04d8635247b233c7ccb517de4a5eafddbef02.

📒 Files selected for processing (6)
  • src/main/window/createMainWindow.test.ts
  • src/main/window/createMainWindow.ts
  • src/renderer/src/assets/main.css
  • src/renderer/src/assets/terminal.css
  • src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts

Comment on lines +316 to +317
@apply text-foreground;
background-color: transparent;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix Stylelint empty-line rule in body declarations.

Line 317 currently violates declaration-empty-line-before per the static-analysis output. Add the required blank line before background-color: transparent; to keep lint green.

Suggested fix
   body {
     `@apply` text-foreground;
+
     background-color: transparent;
     margin: 0;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@apply text-foreground;
background-color: transparent;
`@apply` text-foreground;
background-color: transparent;
🧰 Tools
🪛 Stylelint (17.13.0)

[error] 317-317: Expected empty line before declaration (declaration-empty-line-before)

(declaration-empty-line-before)

Source: Linters/SAST tools

@TomBonness
TomBonness force-pushed the fix-terminal-transparency-blur-scrollbar branch from d3e04d8 to cabdc6e Compare June 15, 2026 23:02
@ghost

ghost commented Jun 15, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 4 individual chapters for you:

Title
1 Configure macOS window transparency and vibrancy
2 Enable transparent renderer background
3 Fallback to DOM renderer for transparent terminals
4 Style terminal scrollbars for transparency
Open in Stage

Chapters generated by Stage for commit cabdc6e on Jun 15, 2026 11:41pm UTC.

@nwparker

nwparker commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded by #36580, which adds Opaque, Translucent and Blurred window materials on macOS, Windows and Linux (plus Reduce Visual Effects) and fixes the transparent-terminal flicker. Thank you for this PR, it shaped the design.

@nwparker nwparker closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants