fix(apple): reveal Simulator.app after a boot without taking focus

Merged
TH
11d ago
+31-15

Summary

Every cold simulator boot, through open or boot, ran open -a Simulator. That activates Simulator.app, so its window jumped in front of whatever the user was working in. The call was added to focus the window for screenshot capture (#167); capture no longer depends on it.

Both call sites now run open -g -a Simulator. This launches or reveals Simulator.app without activating it, so the frontmost app keeps focus:

  • readiness/runtime.ts showSimulator
  • core/simulator.ts openIosSimulatorApp

The timeout constant is renamed from IOS_SIMULATOR_FOCUS_TIMEOUT_MS to IOS_SIMULATOR_SHOW_TIMEOUT_MS. 5 files.

Validation

  • Tested commit a33cafef87.

  • pnpm check:affected --run passed (443 files, 3454 tests).

  • New readiness test: a cold boot opens Simulator with -g. It fails when -g is removed.

  • Live run on an iPhone 17 Pro / iOS 26.2 sim, shut down first, then open com.apple.Preferences --platform ios:

    • the request log shows open -g -a Simulator;
    • Simulator.app was running afterwards but never became the frontmost app.

    I only ran this branch, not main, to avoid stealing the user's focus while testing.