collab: Add screen selector (#31506)

Instead of selecting a screen to share arbitrarily, we'll now allow user
to select the screen to share. Note that sharing multiple screens at the
time is still not supported (though prolly not too far-fetched).

Related to #4666

![image](https://github.com/user-attachments/assets/1afb664f-3cdb-4e0a-bb29-9d7093d87fa5)

Release Notes:

- Added screen selector dropdown to screen share button

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Piotr Osiewicz 2025-07-21 13:44:51 +02:00 committed by GitHub
parent 57ab09c2da
commit 88af35fe47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 473 additions and 145 deletions

View file

@ -326,11 +326,11 @@ pub(crate) async fn capture_local_video_track(
capture_source: &dyn ScreenCaptureSource,
cx: &mut gpui::AsyncApp,
) -> Result<(crate::LocalVideoTrack, Box<dyn ScreenCaptureStream>)> {
let resolution = capture_source.resolution()?;
let metadata = capture_source.metadata()?;
let track_source = gpui_tokio::Tokio::spawn(cx, async move {
NativeVideoSource::new(VideoResolution {
width: resolution.width.0 as u32,
height: resolution.height.0 as u32,
width: metadata.resolution.width.0 as u32,
height: metadata.resolution.height.0 as u32,
})
})?
.await?;

View file

@ -5,7 +5,7 @@ use crate::{
};
use anyhow::Result;
use collections::HashMap;
use gpui::{AsyncApp, ScreenCaptureSource, ScreenCaptureStream};
use gpui::{AsyncApp, ScreenCaptureSource, ScreenCaptureStream, TestScreenCaptureStream};
#[derive(Clone, Debug)]
pub struct LocalParticipant {
@ -119,7 +119,3 @@ impl RemoteParticipant {
self.identity.clone()
}
}
struct TestScreenCaptureStream;
impl gpui::ScreenCaptureStream for TestScreenCaptureStream {}