Skip to content

fix(window): do not cover platform blur with opaque backgroundColor - #10064

Closed
innocarpe wants to merge 0 commit into
stablyai:mainfrom
innocarpe:fix/macos-window-blur-opacity
Closed

innocarpe wants to merge 0 commit into
stablyai:mainfrom
innocarpe:fix/macos-window-blur-opacity

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

Description

User-facing: On macOS (and Windows acrylic), Window Blur + Background Opacity could look completely broken — the window stayed fully opaque even after enabling blur and lowering opacity.

Technical: createMainWindow always set an opaque backgroundColor (#0a0a0a / #ffffff) even when blur enabled platform materials. That solid fill covered macOS vibrancy / Windows acrylic, so lowering terminalBackgroundOpacity only revealed the same solid chrome color — never the desktop.

Fixes #8797

Impact / ELI5

Orca was putting a solid painted board behind the glass. Turning on “blur” and lowering opacity only made the terminal more see-through to that solid board. This removes the solid board when blur is on, so you can actually see the frosted desktop through a translucent terminal.

Root cause

From the has_repro handoff (docs/bug-reproductions/8797.md):

  1. Blur path set vibrancy: 'under-window' + transparent: true (Darwin) or backgroundMaterial: 'acrylic' (Windows).
  2. Constructor always applied opaque backgroundColor: dark ? '#0a0a0a' : '#ffffff'.
  3. Terminal opacity only rewrites the xterm theme to rgba(...) — it never changed the BrowserWindow fill.
  4. Result: transparent terminal sits on solid black/white; blur never shows.

Fix

New pure helper resolveMainWindowChromeOptions:

Platform Blur off Blur on
macOS opaque fill #00000000 + vibrancy: under-window + visualEffectState: active + transparent: true
Windows opaque fill #00000000 + backgroundMaterial: acrylic
Linux opaque fill opaque fill (no material)

createMainWindow consumes the helper instead of hard-coding the opaque fill.

Evidence

pnpm exec vitest run --config config/vitest.config.ts \
  src/main/window/main-window-chrome-options.test.ts \
  src/main/window/repro-8797-blur-opacity-noop.test.ts

Result: 8/8 passed.

Manual (macOS):

  1. Settings → Terminal → Window → enable Window Blur → restart.
  2. Lower Background Opacity below 1.
  3. Terminal should reveal blurred desktop (chrome UI still solid via CSS).

User-regression-tradeoffs

Checklist notes

  • Cross-platform: Darwin + Windows materials; Linux no-op path preserved.
  • SSH/remote: n/a (local BrowserWindow chrome only).
  • Agents/integrations: n/a.
  • Performance: same window-creation path; no runtime cost.
  • UI: relies on existing renderer surfaces for chrome; terminal opacity path unchanged.
  • Security: n/a.

AI review summary

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a platform-aware resolver for main-window background and blur options. Main-window creation now uses the resolver for backgroundColor and platform blur settings. Tests cover macOS vibrancy, Windows acrylic, Linux fallback behavior, resolver wiring, transparent window backgrounds, and terminal background opacity composition.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main fix: preventing blur from being hidden by an opaque window background.
Description check ✅ Passed The description is mostly complete and covers summary, testing, review, security, and notes, but it lacks the template's explicit Screenshots section.
Linked Issues check ✅ Passed The PR addresses #8797 by making blur windows use platform-specific chrome and a transparent background instead of an opaque fill.
Out of Scope Changes check ✅ Passed The added helper and regression tests are directly tied to the blur/background-opacity fix, with no unrelated changes evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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 Plus

Run ID: 2ebf81d2-cb54-41e1-958a-92a0c09c1cff

📥 Commits

Reviewing files that changed from the base of the PR and between bae29fd and a0b889aeabba7f8b6fa4b66414dc6f7e4461110b.

📒 Files selected for processing (4)
  • src/main/window/createMainWindow.ts
  • src/main/window/main-window-chrome-options.test.ts
  • src/main/window/main-window-chrome-options.ts
  • src/main/window/repro-8797-blur-opacity-noop.test.ts

Comment on lines +48 to +53
if (input.platform === 'win32') {
return {
backgroundColor: '#00000000',
platformBlurOptions: {
backgroundMaterial: 'acrylic'
}

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Files:\n'
git ls-files 'src/main/window/*.ts' | sort

printf '\nRelevant file outlines/contents:\n'
wc -l src/main/window/main-window-chrome-options.ts src/main/window/createMainWindow.ts src/main/window/main-window-chrome-options.test.ts

printf '\n--- main-window-chrome-options.ts ---\n'
cat -n src/main/window/main-window-chrome-options.ts

printf '\n--- createMainWindow.ts relevant section ---\n'
sed -n '200,270p' src/main/window/createMainWindow.ts | cat -n -v

printf '\n--- tests ---\n'
sed -n '1,120p' src/main/window/main-window-chrome-options.test.ts | cat -n -v

printf '\nSearch for ChromeOptions type/usage:\n'
rg -n "type .*Chrome|platformBlurOptions|resolveMainWindowChromeOptions|BrowserWindow|transparent|frame:" src/main/window src -g '*.ts' | head -200

Repository: stablyai/orca

Length of output: 32190


🌐 Web query:

Electron BrowserWindow transparent backgroundColor alpha frame Windows documentation

💡 Result:

To create a transparent window in Electron, you must configure the BrowserWindow options with transparent: true. Crucially, on Windows, this setting will not function unless the window is also frameless (i.e., frame: false) [1][2]. Key properties for managing transparency and window appearance include: 1. transparent: Set this to true to make the window transparent [1][3]. On Windows, this requires the window to be frameless [1]. 2. frame: Set this to false to create a frameless window [4]. Frameless windows remove the standard system title bar and borders. 3. backgroundColor: This property sets the window's background color [1][5]. When transparent is set to true, you can use hexadecimal values with alpha channels (e.g., #80FFFFFF) to define the background's opacity [1][6]. In newer Electron versions, setBackgroundColor also supports formats like RGBA, HSLA, and named colors, where the alpha channel can be specified [5]. 4. thickFrame (Windows specific): When using frame: false, you can optionally set thickFrame: true (the default) to retain the standard Windows window frame style (which provides window shadows, animations, and resizing handles) while still allowing the window content to be transparent [7][4]. If set to false, these native window features are disabled [7][4]. For controlling window opacity after initialization, you can use the win.setOpacity(opacity) method, where opacity is a number between 0.0 (fully transparent) and 1.0 (fully opaque) [8][1]. This method is implemented on Windows and macOS [1].

Citations:


Make the Windows acrylic window actually transparent.

Electron only honors backgroundColor alpha with transparent: true, and Windows transparent windows require frame: false. The Windows branch leaves both out, so the acrylic window can remain opaque.

  • src/main/window/main-window-chrome-options.ts#L48-L53: return transparent: true and frame: false alongside backgroundColor: '#00000000' and backgroundMaterial: 'acrylic'; update the option type/comment.
  • src/main/window/createMainWindow.ts#L247: ensure frame from the spy/contract does not override this when Windows blur is enabled.
  • src/main/window/main-window-chrome-options.test.ts#L33-L41: assert the full Windows transparent-window contract.
📍 Affects 3 files
  • src/main/window/main-window-chrome-options.ts#L48-L53 (this comment)
  • src/main/window/createMainWindow.ts#L227-L247
  • src/main/window/main-window-chrome-options.test.ts#L33-L41

@innocarpe

Copy link
Copy Markdown
Contributor Author

Accidentally closed when a bad rebase helper force-pushed an empty tip. Restored and continued as #10349.

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.

[Bug]: "Background Opacity" and "Window Blur" have no visible effect on macOS

1 participant