Skip to content

Commit 36ee402

Browse files
committed
fmt
1 parent 7da02c2 commit 36ee402

File tree

5 files changed

+47
-14
lines changed

5 files changed

+47
-14
lines changed

apps/desktop/src-tauri/src/recording.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use regex::Regex;
3131
use serde::{Deserialize, Serialize};
3232
use specta::Type;
3333
use std::borrow::Cow;
34+
use std::error::Error as StdError;
3435
use std::{
3536
any::Any,
3637
collections::{HashMap, VecDeque},
@@ -54,7 +55,9 @@ use crate::{
5455
audio::AppSounds,
5556
auth::AuthStore,
5657
create_screenshot,
57-
general_settings::{GeneralSettingsStore, PostDeletionBehaviour, PostStudioRecordingBehaviour},
58+
general_settings::{
59+
self, GeneralSettingsStore, PostDeletionBehaviour, PostStudioRecordingBehaviour,
60+
},
5861
open_external_link,
5962
presets::PresetsStore,
6063
thumbnails::*,

apps/desktop/src-tauri/src/target_select_overlay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn should_skip_window(window: &Window, exclusions: &[WindowExclusion]) -> bool {
142142

143143
exclusions.iter().any(|entry| {
144144
entry.matches(
145-
bundle_identifier,
145+
bundle_identifier.as_deref(),
146146
owner_name.as_deref(),
147147
window_title.as_deref(),
148148
)

apps/desktop/src-tauri/src/window_exclusion.rs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use scap_targets::Window;
2-
use scap_targets::WindowId;
1+
use scap_targets::{Window, WindowId};
32
use serde::{Deserialize, Serialize};
43
use specta::Type;
54

@@ -61,3 +60,34 @@ impl WindowExclusion {
6160
false
6261
}
6362
}
63+
64+
pub fn resolve_window_ids(exclusions: &[WindowExclusion]) -> Vec<WindowId> {
65+
if exclusions.is_empty() {
66+
return Vec::new();
67+
}
68+
69+
Window::list()
70+
.into_iter()
71+
.filter_map(|window| {
72+
let owner_name = window.owner_name();
73+
let window_title = window.name();
74+
75+
#[cfg(target_os = "macos")]
76+
let bundle_identifier = window.raw_handle().bundle_identifier();
77+
78+
#[cfg(not(target_os = "macos"))]
79+
let bundle_identifier = None::<&str>;
80+
81+
exclusions
82+
.iter()
83+
.find(|entry| {
84+
entry.matches(
85+
bundle_identifier.as_deref(),
86+
owner_name.as_deref(),
87+
window_title.as_deref(),
88+
)
89+
})
90+
.map(|_| window.id())
91+
})
92+
.collect()
93+
}

crates/recording/src/cursor.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ fn flush_cursor_data(output_path: &Path, moves: &[CursorMoveEvent], clicks: &[Cu
4848
clicks: clicks.to_vec(),
4949
moves: moves.to_vec(),
5050
};
51-
if let Ok(json) = serde_json::to_string_pretty(&events) {
52-
if let Err(e) = std::fs::write(output_path, json) {
53-
tracing::error!(
54-
"Failed to write cursor data to {}: {}",
55-
output_path.display(),
56-
e
57-
);
58-
}
51+
if let Ok(json) = serde_json::to_string_pretty(&events)
52+
&& let Err(e) = std::fs::write(output_path, json)
53+
{
54+
tracing::error!(
55+
"Failed to write cursor data to {}: {}",
56+
output_path.display(),
57+
e
58+
);
5959
}
6060
}
6161

crates/recording/src/sources/screen_capture/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ impl<TCaptureFormat: ScreenCaptureFormat> ScreenCaptureConfig<TCaptureFormat> {
305305
let target_refresh = validated_refresh_rate(display.refresh_rate());
306306
let fps = std::cmp::max(1, std::cmp::min(max_fps, target_refresh));
307307

308-
let output_size = crop_bounds
309-
.and_then(|b| {
308+
let output_size: PhysicalSize = crop_bounds
309+
.and_then(|b| -> Option<PhysicalSize> {
310310
#[cfg(target_os = "macos")]
311311
{
312312
let logical_size = b.size();

0 commit comments

Comments
 (0)