Summary
On first-time npm run dev (macOS), the onboarding "Screen Recording permission required" card opens System Settings → Privacy & Security → Screen Recording, but the running dev binary (Electron / VS Code helper / iTerm helper) does not appear in the list. The user has nothing to toggle, and screen capture stays blocked.
Repro
- Fresh macOS state (or
tccutil reset ScreenCapture to simulate first run).
npm run dev from VS Code's integrated terminal (or iTerm).
- Complete onboarding until the Screen Recording permission card.
- Click Open Settings.
- Observe: the dev binary is not listed under Screen Recording — only stale entries (e.g. iTerm) or nothing at all.
Expected
The binary that triggered the permission check should appear in the Screen Recording list so the user can toggle it on.
Root cause
systemPreferences.getMediaAccessStatus('screen') (used in src/main/ipc-handlers.ts onboarding:getPermissions) is read-only — it does not register the calling binary with macOS TCC. macOS only adds an app to the Screen Recording list after it has attempted a capture (e.g. via desktopCapturer.getSources). Packaged .app bundles register on their own first capture; the dev binary doesn't until something actively calls into the capture API.
Fix
In dev mode only (gated by !app.isPackaged), invoke a no-op desktopCapturer.getSources({ types: ['screen'], thumbnailSize: { width: 1, height: 1 } }) from inside onboarding:getPermissions when screen status is not granted. This forces TCC to register the binary so it shows up in System Settings.
Production builds are unaffected — the packaged VideoDB Focusd.app registers itself on first real capture and does not need the warmup.
After the fix, running npm run dev from VS Code and clicking Open Settings shows VS Code (the helper that spawned Electron) in the Screen Recording list. Toggling it on and relaunching dev grants screen capture as expected.
Environment
- macOS (TCC-managed permissions)
- Electron via electron-vite (
npm run dev)
- Bundle id:
com.videodb.focusd
Summary
On first-time
npm run dev(macOS), the onboarding "Screen Recording permission required" card opens System Settings → Privacy & Security → Screen Recording, but the running dev binary (Electron / VS Code helper / iTerm helper) does not appear in the list. The user has nothing to toggle, and screen capture stays blocked.Repro
tccutil reset ScreenCaptureto simulate first run).npm run devfrom VS Code's integrated terminal (or iTerm).Expected
The binary that triggered the permission check should appear in the Screen Recording list so the user can toggle it on.
Root cause
systemPreferences.getMediaAccessStatus('screen')(used insrc/main/ipc-handlers.tsonboarding:getPermissions) is read-only — it does not register the calling binary with macOS TCC. macOS only adds an app to the Screen Recording list after it has attempted a capture (e.g. viadesktopCapturer.getSources). Packaged.appbundles register on their own first capture; the dev binary doesn't until something actively calls into the capture API.Fix
In dev mode only (gated by
!app.isPackaged), invoke a no-opdesktopCapturer.getSources({ types: ['screen'], thumbnailSize: { width: 1, height: 1 } })from insideonboarding:getPermissionswhen screen status is notgranted. This forces TCC to register the binary so it shows up in System Settings.Production builds are unaffected — the packaged
VideoDB Focusd.appregisters itself on first real capture and does not need the warmup.After the fix, running
npm run devfrom VS Code and clicking Open Settings shows VS Code (the helper that spawned Electron) in the Screen Recording list. Toggling it on and relaunching dev grants screen capture as expected.Environment
npm run dev)com.videodb.focusd