Skip to content

Handle disconnected mic/camera selections gracefully - #2104

Open
richiemcilroy wants to merge 7 commits into
mainfrom
disconnected-devices
Open

Handle disconnected mic/camera selections gracefully#2104
richiemcilroy wants to merge 7 commits into
mainfrom
disconnected-devices

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Aug 9, 2026

Copy link
Copy Markdown
Member

Selecting a mic/camera, unplugging them (e.g. undocking a laptop), and relaunching left Cap in a stuck error state: the camera preview window flashed with a persistent "Camera unavailable" error on every launch and picker open, the device rows still showed the missing devices as On, and recording refused to start with "Selected camera is no longer available".

Device selections are now treated as remembered preferences resolved at use time:

  • set_mic_input / set_camera_input quietly keep the selection when the device is not connected instead of running the show-window/retry/toast loop (same for the duplicate restore loop that ran on every main-window reveal).
  • Recording start degrades instead of aborting: a missing camera or mic is skipped with a single "Recording without camera/microphone" notification. Camera-only mode still requires its camera. Bluetooth-renamed mics are fuzzy-matched at start instead of failing.
  • Main-window rows show the device name with a gray "Not connected" pill instead of a blue "On", and hide the preview/settings shortcuts while disconnected.
  • When the device reappears (re-dock), it is re-applied automatically via the existing selection path, restoring the mic meter and camera preview.

Device-present paths are unchanged. Validated with cargo check, cargo test -p cap-desktop --lib (141 passed), tsc --noEmit, and vitest run (91 passed).

Greptile Summary

The PR treats selected microphones and cameras as remembered preferences that may temporarily be unavailable.

  • Recording now omits disconnected optional devices rather than aborting, while camera-only capture continues to require a camera.
  • The main window marks unavailable selections as disconnected, hides unusable controls, and restores inputs when devices return.
  • Frontend and backend microphone resolution now share fuzzy matching for Bluetooth profile-name changes.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/desktop/src-tauri/src/lib.rs Preserves unavailable device selections, releases idle feeds, and exposes consistent availability and fuzzy-matching helpers.
apps/desktop/src-tauri/src/recording.rs Degrades recording startup gracefully when optional selected camera or microphone devices are unavailable.
apps/desktop/src-tauri/src/windows.rs Avoids retrying camera initialization during main-window restoration when the remembered camera is disconnected.
apps/desktop/src/routes/(window-chrome)/new-main/index.tsx Resolves Bluetooth microphone renames consistently, derives disconnected state, and reapplies devices after reconnection.
apps/desktop/src/routes/(window-chrome)/new-main/CameraSelect.tsx Displays disconnected camera state and suppresses preview and settings shortcuts that cannot work.
apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsx Displays disconnected microphone state and suppresses stale level and settings controls.
apps/desktop/src/routes/(window-chrome)/new-main/TargetSelectInfoPill.tsx Adds the gray Not connected presentation for remembered but unavailable devices.

Reviews (2): Last reviewed commit: "chore: drop redundant disconnected-prop ..." | Re-trigger Greptile

Context used:

@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Comment thread apps/desktop/src/routes/(window-chrome)/new-main/index.tsx Outdated
Comment thread apps/desktop/src/routes/(window-chrome)/new-main/CameraSelect.tsx Outdated
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

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