Skip to content

fix(hud): open no camera preview window at launch while the camera is off - #1647

Open
EtienneLescot wants to merge 1 commit into
mainfrom
fix/1639-mac-hud-invisible-camera-preview
Open

EtienneLescot wants to merge 1 commit into
mainfrom
fix/1639-mac-hud-invisible-camera-preview

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Refs #1639

Why

On macOS 15.3.1, v2.3.0's HUD exists and renders but never paints; v2.2.2 paints with the same HUD window options and the same content protection. The HUD's main-process code did not change between the tags. The one new window macOS gets at launch is the floating camera preview: the HUD configures it on mount, camera on or off, and CameraPreviewController.configure created it every time, transparent, always on top and content-protected, beside the HUD. OPENSCREEN_DISABLE_CONTENT_PROTECTION=1 also lifts protection from that window, which fits the reporter's workaround.

Change

configure no longer creates the preview window while the camera is off. It is created once the camera is turned on, as before. The macOS capture paths still reserve it before reading exclusion IDs (ensureMacCameraPreviewWindow), so exclusions and Apple-picker picks behave as before. Content protection stays on for every window.

Not verified

  • No macOS 15 machine is available to us; our mac runs macOS 27, where protection is already off. The root cause is inferred from the diff, not reproduced.
  • If the preview window is the trigger, the HUD may still vanish once the camera is on or after an Apple-picker pick. The reporter's test will tell which; the follow-up would then be about the preview's own protection.

Checks

npx vitest --run electron/cameraPreview.test.ts src/hooks/useFloatingCameraPreview.test.tsx, both typechecks, Biome. No rendering path touched: window lifetime only.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • When the camera is off at launch, no camera preview window is created. Turning the camera on still creates the preview and allows it to appear once ready. This avoids an unnecessary preview window while the camera is disabled.

… off

v2.3.0 created the floating camera preview window, transparent and
content-protected, the moment the HUD mounted, camera on or off. It is
the only new window macOS gets at launch since v2.2.2, where the same
HUD with the same content protection paints. Create it only once the
camera is on; the macOS capture paths still reserve it before they read
exclusion IDs.

Refs #1639
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Camera preview configuration now skips window creation when the camera is disabled and no preview window exists. The test verifies that enabling the camera creates a window.

Changes: Camera preview lifecycle

Layer / File(s) Summary
Conditional preview window creation
electron/cameraPreview.ts, electron/cameraPreview.test.ts
configure skips creating a window when the camera is disabled and no window exists. The test verifies that enabling the camera creates one.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related issues

Merge Risk: Minimal · up to 412fe

The camera preview window is no longer created at launch while the camera is off, and it is created when the camera is turned on. No defects were found in the change. Whether this resolves the macOS HUD painting issue remains unconfirmed by the author.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: the HUD no longer opens the camera preview window at launch while the camera is off. It matches the raw summary, which says configure returns without calling ensure w…
Description check Passed The description covers the Why, Change, Not verified, and Checks sections. It explains the regression on macOS 15.3.1, the cause inferred from the diff, the fix, and the test commands. It gives a Refs…
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.
Full details: Title check

Explanation

The title states the main change: the HUD no longer opens the camera preview window at launch while the camera is off. It matches the raw summary, which says configure returns without calling ensure when the camera is disabled and no window exists. The title is specific and follows the conventional-commit style.

Full details: Description check

Explanation

The description covers the Why, Change, Not verified, and Checks sections. It explains the regression on macOS 15.3.1, the cause inferred from the diff, the fix, and the test commands. It gives a Refs link to issue #1639, which fits a partial fix. It does not fill in the template's Type of change, Release impact, Desktop impact, Screenshots, or Testing headings, and it omits the Fixes/Refs heading format. These gaps are non-critical, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 252317ea-0f2c-471e-bc57-b6bf0086abfc
Commits

Reviewing files that changed from the base of the PR and between 00a0d96 and 412fe9a.

Files selected for processing: 2

  • electron/cameraPreview.test.ts
  • electron/cameraPreview.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

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