mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(window): add the macOS blur surface for Background Opacity and Window Blur (partial)
macOS configured no vibrancy surface at all, and an opaque fill sat between the desktop and the terminal, so Background Opacity and Window Blur both looked like no-ops. Adds a platform-gated blur surface (`resolveMainWindowBlurSurface`, covering macOS vibrancy / Windows acrylic / Linux fallback) and a root class that drops the opaque fill so the opacity token reaches the compositor. > [!WARNING] > **This does not close #8797 — it is deliberately `Refs`, not `Fixes`.** > I measured it on macOS with a dedicated isolated profile, identical app state, same wallpaper and window geometry, native `screencapture`, toggling only `windowBackgroundBlur` with a restart between runs: > > | Region | Blur OFF | Blur ON | Mean abs diff | > | --- | --- | --- | --- | > | Terminal pane | RGB(48.0, 53.0, 61.0) | RGB(50.0, 55.0, 63.1) | 2.0 / 255 | > | Sidebar | RGB(46.3, 46.4, 46.4) | RGB(46.3, 46.4, 46.4) | 0 — pixel-identical | > > The renderer half provably works (`window-blur` class applied; `html`/`body`/`#root` compute to `rgba(0,0,0,0)`; `.xterm` at `rgba(40,44,52,0.55)`), but the native vibrancy never reaches the screen, so the setting is still not visibly effective. Most likely Electron keeps an opaque window backing without `transparent: true`, which #8482 removed on purpose. > > Kept because it is a correct, unit-tested prerequisite. Merge or hold at your discretion — one machine, one macOS version, external display. Refs #8797 Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -49,6 +49,7 @@ import { rectHasVisibleAreaOnAnyDisplay } from './window-bounds-validation'
|
||||
import { closeDashboardPopout } from './dashboard-popout-window'
|
||||
import { installPrivilegedWindowNavigationPolicy } from './privileged-window-navigation'
|
||||
import { isMacosTahoeOrNewer } from './macos-tahoe-release'
|
||||
import { resolveMainWindowBlurSurface } from './main-window-blur-surface'
|
||||
import { registerPluginPanelNavigationGuard } from '../plugins/plugin-panel-navigation-guard'
|
||||
|
||||
// Why: show/restore/resume can overlap before the size nudge resets; never capture the temporary width as the next baseline.
|
||||
@@ -247,11 +248,13 @@ export function createMainWindow(
|
||||
// Why: webview guests expose no safe transcript insertion target; let Cmd/Ctrl+E reach the page instead of dropping dictation text.
|
||||
return false
|
||||
})
|
||||
const blur = settings?.windowBackgroundBlur ?? false
|
||||
// Why: only Windows acrylic is ever visible; macOS vibrancy+transparent sat behind our opaque background yet
|
||||
// forced per-frame WindowServer alpha compositing (#8482). Applies at creation only, so it needs a restart.
|
||||
const platformBlurOptions =
|
||||
blur && process.platform === 'win32' ? { backgroundMaterial: 'acrylic' as const } : {}
|
||||
// Why: the blur material is the window backdrop, so an opaque fill has to be dropped alongside it (#8797).
|
||||
// Applies at creation only, so it needs a restart.
|
||||
const { backgroundColor, blurOptions } = resolveMainWindowBlurSurface({
|
||||
platform: process.platform,
|
||||
blur: settings?.windowBackgroundBlur ?? false,
|
||||
dark: nativeTheme.shouldUseDarkColors
|
||||
})
|
||||
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: savedBounds?.width ?? defaultBounds.width,
|
||||
@@ -265,7 +268,7 @@ export function createMainWindow(
|
||||
acceptFirstMouse: true,
|
||||
// Why: auto-hide the Windows/Linux menu bar to save a row (Alt reveals it); macOS uses the system menu bar anyway.
|
||||
autoHideMenuBar: true,
|
||||
backgroundColor: nativeTheme.shouldUseDarkColors ? '#0a0a0a' : '#ffffff',
|
||||
...(backgroundColor ? { backgroundColor } : {}),
|
||||
// Why: macOS 'hiddenInset' keeps native traffic lights in our custom titlebar; Windows 'hidden' removes the OS title bar so it doesn't double up.
|
||||
titleBarStyle:
|
||||
process.platform === 'darwin'
|
||||
@@ -285,7 +288,7 @@ export function createMainWindow(
|
||||
}
|
||||
: {}),
|
||||
icon: getAppIconPath(settings?.appIcon),
|
||||
...platformBlurOptions,
|
||||
...blurOptions,
|
||||
webPreferences: {
|
||||
preload: join(__dirname, '../preload/index.js'),
|
||||
sandbox: true,
|
||||
|
||||
Reference in New Issue
Block a user