Screen share 26: Source picker (#173) #242

Manually merged
charles merged 5 commits from screenshare-26-ui-source-picker into screenshare 2026-11-12 09:48:21 +00:00
Owner

Stacked on: screenshare-25-ui-share-controls

What this builds

The screen-share source picker (spec §10 "Source picker"), cloned from fluxer_app/src/features/voice/components/modals/ScreenSharePickerModal.{tsx,module.css} and screen_share_picker_modal/{PickerGrid,PickerCardButton,NativeDisplayPickerState,PickerEmptyState,useNativePickerCopy}.tsx. No Electron reference image is attached (no Electron client on this machine); the dimensions come from ScreenSharePickerModal.module.css (each constant names its rule), the strings from the msg() descriptors.

  • screens/main/screenshare/picker.rs: a modal over the main screen while the store is GoLive::Picking. Size min(73.75rem, window − clamp(2rem, 4vw, 4rem)) × min(47.5rem, …), min height min(32.5rem, window − 1rem), the ≤900 px and ≤520 px media queries (metrics(), unit-tested), radius 1rem, backdrop rgba(0,0,0,.35) (blur left out).
  • Segmented tabs "Applications" / "Entire screen" (AppWindow / Monitor icons added to theme::icons from @phosphor-icons/react 2.1.10, fill weight); window cards on the first, screen cards on the second.
  • 2-column grid of 16:9 cards: 2 px white-14 % border (26 % on hover), radius .75rem, black, the thumbnail from FrameBus[VideoKey::Source { id }] through the video widget (Fit::Contain) or the placeholder icon; hover overlay 52 % black with the white "Share screen" pill; icon + title under it ("App window" / "Display" when the source has no title).
  • A card click starts the share at once: StartScreenShare(Source(id)), or ChangeScreenShareSource(Source(id)) when opened by "Change stream".
  • Empty states "No application windows found" / "No displays found"; nothing while the backend has not listed its sources yet.
  • Wayland (capabilities.in_app_picker == false): each tab shows the native-picker state with the original's copy and "Open system picker" → StartScreenShare(SystemPicker) (ChangeScreenShareSource(SystemPicker) in switch mode).
  • Footer: the mode summary ("Screen share • Clearer text • 720p • 30 FPS • Shared window", from stream_settings_model and the audio settings), the previews notice with "Disable", and the gear, which opens the stream settings menu of Task 25 for the shown tab (MenuOrigin::Picker: settings_menu::full_in(app, Some(tab context)), so "Capture app audio" on Applications and the toggle writes ShareAppAudio; no "Screen share settings" row, as applyToLiveStream={false}).
  • A click beside the modal and Escape send CloseScreenSharePicker; Escape is left to the gear's menu while that is open.

Tests

  • crates/fluxer-ui/tests/screenshare_picker.rs: tabs_split_screens_and_windows, card_click_starts_share (clicks through the real widget tree; also Escape and the backdrop), switch_mode_changes_source, wayland_shows_system_picker_state, footer_summary_text (also the gear's menu and its per-tab sound checkbox). Written first and seen failing (commit aa1882e). Follow-ups opened: #237, #238.
  • Unit tests in picker.rs: metrics_follow_the_css, summary_joins_with_bullets.
  • Screenshots picker_windows (fake backend's sources, one window card with a test-pattern thumbnail on the FrameBus, one with the placeholder) and picker_wayland, added to docs/screenshots/README.md. The goldens were drawn on this machine's hardware Vulkan adapter (no lavapipe here); the existing goldens pass on it within the tolerance, but if the Linux runner disagrees they need redrawing on lavapipe.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. No capture/encoder/device tests apply to this task.

Deviations and notes for the reviewer

  • The runtime's FrameBus does not reach the UI yet: fluxer_ui::run takes none and no plan task adds it. The picker reads picker::State::frames: Option<FrameBus> (set in the screenshot test), so in the app every card shows its placeholder until #237 hands the bus over and adds the redraw subscription. Because FrameBus is not PartialEq, screenshare::State no longer derives PartialEq (nothing compared it).
  • "Disable" does nothing yet: the privacy switch is Screen share 13's (#160, not merged). previews_enabled is always true; follow-up #238.
  • The Wayland state is hard to reach in the app: the go-live reducer (Task 10) starts the portal capture by itself as soon as the backend reports no in-app picker, so the store is Picking with such a listing only if something sets it. The picker renders the state the spec asks for whenever that is the case; I left the reducer alone (outside this task's files).
  • Left out: the info button beside the previews notice (its privacy modal is not in the plan), the "Devices" tab (spec §1), the per-window audio and software-encode notices, the load-error state (the capture port has no listing error), the backdrop blur.
  • Outside the Files list, minimally: theme/icons.rs + two SVGs (the plan's "add the icons it needs through theme::icons"), screenshare/settings_menu.rs (full_in taking the share context; full unchanged), tests/screenshots.rs, docs/screenshots/README.md, crates/fluxer-ui/README.md.

Closes #173

🤖 Generated with Claude Code

Stacked on: screenshare-25-ui-share-controls ## What this builds The screen-share source picker (spec §10 "Source picker"), cloned from `fluxer_app/src/features/voice/components/modals/ScreenSharePickerModal.{tsx,module.css}` and `screen_share_picker_modal/{PickerGrid,PickerCardButton,NativeDisplayPickerState,PickerEmptyState,useNativePickerCopy}.tsx`. No Electron reference image is attached (no Electron client on this machine); the dimensions come from `ScreenSharePickerModal.module.css` (each constant names its rule), the strings from the `msg()` descriptors. - `screens/main/screenshare/picker.rs`: a modal over the main screen while the store is `GoLive::Picking`. Size `min(73.75rem, window − clamp(2rem, 4vw, 4rem))` × `min(47.5rem, …)`, min height `min(32.5rem, window − 1rem)`, the ≤900 px and ≤520 px media queries (`metrics()`, unit-tested), radius 1rem, backdrop `rgba(0,0,0,.35)` (blur left out). - Segmented tabs "Applications" / "Entire screen" (AppWindow / Monitor icons added to `theme::icons` from `@phosphor-icons/react` 2.1.10, fill weight); window cards on the first, screen cards on the second. - 2-column grid of 16:9 cards: 2 px white-14 % border (26 % on hover), radius .75rem, black, the thumbnail from `FrameBus[VideoKey::Source { id }]` through the video widget (`Fit::Contain`) or the placeholder icon; hover overlay 52 % black with the white "Share screen" pill; icon + title under it ("App window" / "Display" when the source has no title). - A card click starts the share at once: `StartScreenShare(Source(id))`, or `ChangeScreenShareSource(Source(id))` when opened by "Change stream". - Empty states "No application windows found" / "No displays found"; nothing while the backend has not listed its sources yet. - Wayland (`capabilities.in_app_picker == false`): each tab shows the native-picker state with the original's copy and "Open system picker" → `StartScreenShare(SystemPicker)` (`ChangeScreenShareSource(SystemPicker)` in switch mode). - Footer: the mode summary ("Screen share • Clearer text • 720p • 30 FPS • Shared window", from `stream_settings_model` and the audio settings), the previews notice with "Disable", and the gear, which opens the stream settings menu of Task 25 for the shown tab (`MenuOrigin::Picker`: `settings_menu::full_in(app, Some(tab context))`, so "Capture app audio" on Applications and the toggle writes `ShareAppAudio`; no "Screen share settings" row, as `applyToLiveStream={false}`). - A click beside the modal and Escape send `CloseScreenSharePicker`; Escape is left to the gear's menu while that is open. ## Tests - `crates/fluxer-ui/tests/screenshare_picker.rs`: `tabs_split_screens_and_windows`, `card_click_starts_share` (clicks through the real widget tree; also Escape and the backdrop), `switch_mode_changes_source`, `wayland_shows_system_picker_state`, `footer_summary_text` (also the gear's menu and its per-tab sound checkbox). Written first and seen failing (commit aa1882e). Follow-ups opened: #237, #238. - Unit tests in `picker.rs`: `metrics_follow_the_css`, `summary_joins_with_bullets`. - Screenshots `picker_windows` (fake backend's sources, one window card with a test-pattern thumbnail on the `FrameBus`, one with the placeholder) and `picker_wayland`, added to `docs/screenshots/README.md`. The goldens were drawn on this machine's hardware Vulkan adapter (no lavapipe here); the existing goldens pass on it within the tolerance, but if the Linux runner disagrees they need redrawing on lavapipe. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. No capture/encoder/device tests apply to this task. ## Deviations and notes for the reviewer - **The runtime's `FrameBus` does not reach the UI yet**: `fluxer_ui::run` takes none and no plan task adds it. The picker reads `picker::State::frames: Option<FrameBus>` (set in the screenshot test), so in the app every card shows its placeholder until #237 hands the bus over and adds the redraw subscription. Because `FrameBus` is not `PartialEq`, `screenshare::State` no longer derives `PartialEq` (nothing compared it). - **"Disable" does nothing yet**: the privacy switch is Screen share 13's (#160, not merged). `previews_enabled` is always `true`; follow-up #238. - **The Wayland state is hard to reach in the app**: the go-live reducer (Task 10) starts the portal capture by itself as soon as the backend reports no in-app picker, so the store is `Picking` with such a listing only if something sets it. The picker renders the state the spec asks for whenever that is the case; I left the reducer alone (outside this task's files). - Left out: the info button beside the previews notice (its privacy modal is not in the plan), the "Devices" tab (spec §1), the per-window audio and software-encode notices, the load-error state (the capture port has no listing error), the backdrop blur. - Outside the Files list, minimally: `theme/icons.rs` + two SVGs (the plan's "add the icons it needs through `theme::icons`"), `screenshare/settings_menu.rs` (`full_in` taking the share context; `full` unchanged), `tests/screenshots.rs`, `docs/screenshots/README.md`, `crates/fluxer-ui/README.md`. Closes #173 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Refs #172

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Refs #173

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The picker modal over the main screen while the store picks: Applications /
Entire screen tabs, 2-column 16:9 cards with FrameBus thumbnails and the
hover pill, a click starts the share (or changes the running share's source
in switch mode), the footer summary, the previews notice, the gear's stream
settings menu for the shown tab, the Wayland state with Open system picker,
and Escape / a click beside it to close.

Refs #173

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Independent review: Screen share 26 (Source picker)

Scope: git diff 40d3ea5..origin/screenshare-26-ui-source-picker (4fe84ee).

Checks

  1. Plan tests: all five (tabs_split_screens_and_windows, card_click_starts_share, switch_mode_changes_source, wayland_shows_system_picker_state, footer_summary_text) are in tests/screenshare_picker.rs, committed failing first in aa1882e, and they assert what the plan asks. Strings match the fork's catalogue ("No application windows found", the Wayland portal copy, "Screen share previews are enabled.", "Clearer text"/"Smoother video", "Shared window"/"Entire system"). Screenshots picker_windows and picker_wayland exist with goldens and README rows.
  2. Interfaces: StartScreenShare / ChangeScreenShareSource in switch mode, StartScreenShare(SystemPicker), the tabs, the hover pill, the footer summary, the gear opening the settings menu, the previews notice with "Disable", and Escape all exist. MenuOrigin::Picker is a new variant; no other merged or open branch matches MenuOrigin exhaustively outside screenshare/. Removing PartialEq from screenshare::State breaks no current user.
  3. Invariants: no new dependency, no I/O, and nothing touches fluxer-core. Server or backend data cannot panic the picker: there is no indexing or slicing, sizes are clamped with max(0), and an empty title falls back. No secrets.
  4. Review Focus: no item belongs to this task. #6 (a FrameBus reader must not block) is respected: generation() takes a short read lock and an atomic load.
  5. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in the review worktree: all steps passed, including both picker goldens, on this machine's hardware Vulkan.

Findings

  • minor: picker.rs:689 calls bus.generation(&key) in view code. CLAUDE.md says the UI reads the bus only in widgets::video (draw and redraw_subscription). The call is cheap and reads metadata only, but it is outside the sanctioned place. Either move the placeholder fallback into the video widget, or amend CLAUDE.md to allow generation() checks in views.
  • minor: The gear's menu can go stale. The menu closes only when a picker Message that leaves() arrives. If the store leaves Picking some other way (a disconnect, a capture error, or the reducer going straight to the portal), state.menu stays Some(Picker). menu() hides it while the picker is closed, but the next picker opening shows it again at the old anchor, and Escape then closes the menu instead of the picker. A possible fix: clear a Picker-origin menu in main::view/update when picker::model is None.
  • minor (fidelity): The footer summary uses stream_settings_model(app) with no share context. The original's resolveScreenShareTarget takes context, so the resolution and frame rate can differ per tab. Also, with one specific audio source the native summary says "1 app", while the original shows that source's name (summariseSelectedSources).
  • minor (risk): The goldens were drawn on hardware Vulkan, not lavapipe. Check the Linux runner's screenshot step before merging; redraw on lavapipe if it disagrees.
  • noted, tracked: The running app gets no thumbnails until the shell hands over a bus (#237). "Disable" does nothing until Screen share 13's privacy switch is merged (#238). Both are follow-ups, so they do not block.

Verdict: approve. No blocking findings; local CI is green.

🤖 Generated with Claude Code

## Independent review: Screen share 26 (Source picker) Scope: `git diff 40d3ea5..origin/screenshare-26-ui-source-picker` (4fe84ee). **Checks** 1. Plan tests: all five (`tabs_split_screens_and_windows`, `card_click_starts_share`, `switch_mode_changes_source`, `wayland_shows_system_picker_state`, `footer_summary_text`) are in `tests/screenshare_picker.rs`, committed failing first in aa1882e, and they assert what the plan asks. Strings match the fork's catalogue ("No application windows found", the Wayland portal copy, "Screen share previews are enabled.", "Clearer text"/"Smoother video", "Shared window"/"Entire system"). Screenshots `picker_windows` and `picker_wayland` exist with goldens and README rows. 2. Interfaces: `StartScreenShare` / `ChangeScreenShareSource` in switch mode, `StartScreenShare(SystemPicker)`, the tabs, the hover pill, the footer summary, the gear opening the settings menu, the previews notice with "Disable", and Escape all exist. `MenuOrigin::Picker` is a new variant; no other merged or open branch matches `MenuOrigin` exhaustively outside `screenshare/`. Removing `PartialEq` from `screenshare::State` breaks no current user. 3. Invariants: no new dependency, no I/O, and nothing touches fluxer-core. Server or backend data cannot panic the picker: there is no indexing or slicing, sizes are clamped with `max(0)`, and an empty title falls back. No secrets. 4. Review Focus: no item belongs to this task. #6 (a FrameBus reader must not block) is respected: `generation()` takes a short read lock and an atomic load. 5. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in the review worktree: **all steps passed**, including both picker goldens, on this machine's hardware Vulkan. **Findings** - **minor**: `picker.rs:689` calls `bus.generation(&key)` in view code. CLAUDE.md says the UI reads the bus only in `widgets::video` (draw and `redraw_subscription`). The call is cheap and reads metadata only, but it is outside the sanctioned place. Either move the placeholder fallback into the video widget, or amend CLAUDE.md to allow `generation()` checks in views. - **minor**: The gear's menu can go stale. The menu closes only when a picker `Message` that `leaves()` arrives. If the store leaves `Picking` some other way (a disconnect, a capture error, or the reducer going straight to the portal), `state.menu` stays `Some(Picker)`. `menu()` hides it while the picker is closed, but the next picker opening shows it again at the old anchor, and Escape then closes the menu instead of the picker. A possible fix: clear a `Picker`-origin menu in `main::view`/`update` when `picker::model` is `None`. - **minor (fidelity)**: The footer summary uses `stream_settings_model(app)` with no share context. The original's `resolveScreenShareTarget` takes `context`, so the resolution and frame rate can differ per tab. Also, with one specific audio source the native summary says "1 app", while the original shows that source's name (`summariseSelectedSources`). - **minor (risk)**: The goldens were drawn on hardware Vulkan, not lavapipe. Check the Linux runner's screenshot step before merging; redraw on lavapipe if it disagrees. - **noted, tracked**: The running app gets no thumbnails until the shell hands over a bus (#237). "Disable" does nothing until Screen share 13's privacy switch is merged (#238). Both are follow-ups, so they do not block. **Verdict: approve.** No blocking findings; local CI is green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
charles manually merged commit f98d075b60 into screenshare 2026-11-12 09:48:21 +00:00
Sign in to join this conversation.
No description provided.