Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Account for display scaling on windows in Screen capture mode
Brendan Allan1c7b2bc43d73
diff --git a/crates/media/src/sources/screen_capture.rs b/crates/media/src/sources/screen_capture.rsindex d553cc05c..d826f8317 100644--- a/crates/media/src/sources/screen_capture.rs+++ b/crates/media/src/sources/screen_capture.rs@@ -252,7 +252,13 @@ impl<TCaptureFormat: ScreenCaptureFormat> ScreenCaptureSource<TCaptureFormat> {(x, y)};#[cfg(windows)]- let video_size = (bounds.width as u32, bounds.height as u32);+ // not sure how reliable this is for the general case so just use it for screen capture for now+ let video_size = if matches!(target, ScreenCaptureTarget::Screen { .. }) {+ let [x, y] = scap::capturer::get_output_frame_size(&this.options);+ (x, y)+ } else {+ (bounds.width as u32, bounds.height as u32)+ };this.video_info =VideoInfo::from_raw(RawVideoFormat::Bgra, video_size.0, video_size.1, fps);diff --git a/crates/recording/Cargo.toml b/crates/recording/Cargo.tomlindex 400395cbf..413fcab9a 100644--- a/crates/recording/Cargo.toml+++ b/crates/recording/Cargo.toml@@ -46,3 +46,4 @@ windows = { workspace = true, features = [[dev-dependencies]tempfile = "3.20.0"+tracing-subscriber = "0.3.19"diff --git a/crates/recording/examples/recording-cli.rs b/crates/recording/examples/recording-cli.rsindex a1576004a..6c126d67c 100644--- a/crates/recording/examples/recording-cli.rs+++ b/crates/recording/examples/recording-cli.rs@@ -5,6 +5,8 @@ use cap_recording::RecordingBaseInputs;#[tokio::main]pub async fn main() {+ tracing_subscriber::fmt::init();+let _ = std::fs::remove_dir_all("/tmp/bruh");let _ = std::fs::create_dir("/tmp/bruh");