Skip to content

fix: prevent macOS background cold launch from stealing focus#91

Merged
beubax merged 2 commits into
mainfrom
fix/macos-background-cold-launch
Jul 15, 2026
Merged

fix: prevent macOS background cold launch from stealing focus#91
beubax merged 2 commits into
mainfrom
fix/macos-background-cold-launch

Conversation

@ankitranjan7

Copy link
Copy Markdown
Contributor

Problem

On macOS, the first browser-backed command after a daemon stop brings Cloak Chromium to the foreground even with --window background. PR #65 removed Webcmd-triggered bringToFront() calls, but a cold Playwright persistent-context launch still activates the Chromium application itself.

Closes #90.

Fix

  • cold-launch Cloak Chromium with macOS open -g -n
  • reconnect Playwright through a loopback CDP endpoint
  • retain Cloak fingerprinting, humanization, profile, and password-store arguments
  • explicitly reactivate Chromium only when a later foreground operation requests it
  • leave warm sessions and non-macOS launch paths unchanged

Verification

  • npm run typecheck
  • npm run build
  • npm test — 4,166 passed, 1 skipped
  • cold background launch: ChatGPT remained frontmost for 30/30 samples
  • warm background command: ChatGPT remained frontmost for 15/15 samples
  • explicit foreground tab selection moved focus to Chromium

@ankitranjan7 ankitranjan7 force-pushed the fix/macos-background-cold-launch branch from 52903c6 to 209b6b0 Compare July 14, 2026 07:38
@ankitranjan7 ankitranjan7 requested a review from beubax July 14, 2026 08:03
@beubax beubax merged commit c5346f8 into main Jul 15, 2026
25 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.

[Bug]: Cold background browser launch steals macOS focus

2 participants