Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

chore: bump xcap (#1568)

ologbonowiwidde7b4312e79
diff --git a/screenpipe-vision/Cargo.toml b/screenpipe-vision/Cargo.toml
index 78b071e03..6afa2fa5a 100644
--- a/screenpipe-vision/Cargo.toml
+++ b/screenpipe-vision/Cargo.toml
@@ -44,7 +44,7 @@ tracing = { workspace = true }
which = "6.0"
serde = "1.0.200"
-xcap = "0.3.3"
+xcap = { git = "https://github.com/nashaofu/xcap", rev = "09c11cc" }
once_cell = { workspace = true }
base64 = "0.22.1"
diff --git a/screenpipe-vision/src/bin/screenpipe-vision.rs b/screenpipe-vision/src/bin/screenpipe-vision.rs
index a508631c3..71a27b680 100644
--- a/screenpipe-vision/src/bin/screenpipe-vision.rs
+++ b/screenpipe-vision/src/bin/screenpipe-vision.rs
@@ -35,10 +35,10 @@ async fn main() {
let languages = cli.language;
// Get monitor ID before spawning the task
- let monitor_id =
- tokio::task::spawn_blocking(|| Monitor::all().unwrap().first().unwrap().id())
- .await
- .unwrap();
+ let monitor_id = tokio::task::spawn_blocking(|| Monitor::all().unwrap().first().unwrap().id())
+ .await
+ .unwrap()
+ .unwrap();
let window_filters = Arc::new(WindowFilters::new(&[], &[]));
diff --git a/screenpipe-vision/src/capture_screenshot_by_window.rs b/screenpipe-vision/src/capture_screenshot_by_window.rs
index 8c72ee87b..b3ff6f01d 100644
--- a/screenpipe-vision/src/capture_screenshot_by_window.rs
+++ b/screenpipe-vision/src/capture_screenshot_by_window.rs
@@ -201,10 +201,10 @@ pub async fn capture_all_visible_windows(
.into_iter()
.filter_map(|window| {
// Extract all necessary data from the window while in the main thread
- let app_name = window.app_name().to_string();
- let title = window.title().to_string();
- let is_focused = window.is_focused();
- let process_id = window.pid();
+ let app_name = window.app_name().unwrap_or_default().to_string();
+ let title = window.title().unwrap_or_default().to_string();
+ let is_focused = window.is_focused().unwrap_or(false);
+ let process_id = window.pid().unwrap_or(0);
// Capture image immediately while we have access to the window
match window.capture_image() {
Ok(buffer) => Some((app_name, title, is_focused, buffer, process_id)),
diff --git a/screenpipe-vision/src/monitor.rs b/screenpipe-vision/src/monitor.rs
index 9a4947ba5..e6fa7d8fc 100644
--- a/screenpipe-vision/src/monitor.rs
+++ b/screenpipe-vision/src/monitor.rs
@@ -19,12 +19,12 @@ pub struct MonitorData {
impl SafeMonitor {
pub fn new(monitor: Monitor) -> Self {
- let monitor_id = monitor.id();
+ let monitor_id = monitor.id().unwrap();
let monitor_data = Arc::new(MonitorData {
- width: monitor.width(),
- height: monitor.height(),
- name: monitor.name().to_string(),
- is_primary: monitor.is_primary(),
+ width: monitor.width().unwrap(),
+ height: monitor.height().unwrap(),
+ name: monitor.name().unwrap(),
+ is_primary: monitor.is_primary().unwrap(),
});
Self {
@@ -40,10 +40,10 @@ impl SafeMonitor {
let monitor = Monitor::all()
.map_err(Error::from)?
.into_iter()
- .find(|m| m.id() == monitor_id)
+ .find(|m| m.id().unwrap() == monitor_id)
.ok_or_else(|| anyhow::anyhow!("Monitor not found"))?;
- if monitor.width() == 0 || monitor.height() == 0 {
+ if monitor.width().unwrap() == 0 || monitor.height().unwrap() == 0 {
return Err(anyhow::anyhow!("Invalid monitor dimensions"));
}
@@ -112,7 +112,7 @@ pub async fn get_monitor_by_id(id: u32) -> Option<SafeMonitor> {
Monitor::all()
.unwrap()
.into_iter()
- .find(|m| m.id() == id)
+ .find(|m| m.id().unwrap() == id)
.map(SafeMonitor::new)
})
.await