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

fix: other os build

Louis Beaumontccd59807eb08
diff --git a/screenpipe-audio/Cargo.toml b/screenpipe-audio/Cargo.toml
index 85518177d..105c2886d 100644
--- a/screenpipe-audio/Cargo.toml
+++ b/screenpipe-audio/Cargo.toml
@@ -19,7 +19,6 @@ serde_json = "1.0"
# Temporary hack check https://github.com/RustAudio/cpal/pull/894
cpal = { git = "https://github.com/Kree0/cpal.git", rev = "dfca186" }
-
# Wav encoding
hound = "3.5"
diff --git a/screenpipe-audio/src/core.rs b/screenpipe-audio/src/core.rs
index afee39de8..bfdad4f25 100644
--- a/screenpipe-audio/src/core.rs
+++ b/screenpipe-audio/src/core.rs
@@ -89,7 +89,16 @@ pub fn record_and_transcribe(
let host = if cfg!(target_os = "macos") {
match device_spec {
// https://github.com/RustAudio/cpal/pull/894
- DeviceSpec::Output(_) => cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?,
+ DeviceSpec::Output(_) => {
+ #[cfg(target_os = "macos")]
+ {
+ cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?
+ }
+ #[cfg(not(target_os = "macos"))]
+ {
+ return Err(anyhow!("ScreenCaptureKit is only available on macOS"));
+ }
+ }
_ => cpal::default_host(),
}
} else {
@@ -271,8 +280,8 @@ pub fn list_audio_devices() -> Result<Vec<AudioDevice>> {
}
}
- // on macos only
- if cfg!(target_os = "macos") {
+ #[cfg(target_os = "macos")]
+ {
let host = cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?;
for device in host.input_devices()? {
if let Ok(name) = device.name() {
@@ -282,7 +291,10 @@ pub fn list_audio_devices() -> Result<Vec<AudioDevice>> {
});
}
}
- } else {
+ }
+
+ #[cfg(not(target_os = "macos"))]
+ {
for device in host.output_devices()? {
if let Ok(name) = device.name() {
devices.push(AudioDevice {
@@ -295,7 +307,6 @@ pub fn list_audio_devices() -> Result<Vec<AudioDevice>> {
Ok(devices)
}
-
// function that return default device to record audio
pub fn default_input_device() -> Result<DeviceSpec> {
let host = cpal::default_host();
@@ -308,16 +319,22 @@ pub fn default_input_device() -> Result<DeviceSpec> {
// function that return default device to record audio
pub fn default_output_device() -> Result<DeviceSpec> {
- let host = cpal::default_host();
- // on mac pick the display capture device
- if cfg!(target_os = "macos") {
+ #[cfg(target_os = "macos")]
+ {
let host = cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?;
- let device = host.default_input_device().unwrap();
+ let device = host
+ .default_input_device()
+ .ok_or_else(|| anyhow!("No default input device found"))?;
info!("Using display capture device: {}", device.name()?);
- Ok(DeviceSpec::Output(Some(device.name()?)))
- } else {
- let device = host.default_output_device().unwrap();
+ return Ok(DeviceSpec::Output(Some(device.name()?)));
+ }
+
+ #[cfg(not(target_os = "macos"))]
+ {
+ let device = host
+ .default_output_device()
+ .ok_or_else(|| anyhow!("No default output device found"))?;
info!("Using default output device: {}", device.name()?);
- Ok(DeviceSpec::Output(Some(device.name()?)))
+ return Ok(DeviceSpec::Output(Some(device.name()?)));
}
}
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 577a0836b..4d19e59b4 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -11,7 +11,6 @@ use screenpipe_audio::{
default_input_device, default_output_device, list_audio_devices, parse_device_spec,
};
-use colored::*;
use screenpipe_server::{start_continuous_recording, DatabaseManager, ResourceMonitor, Server}; // Import the list_audio_devices function
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
@@ -64,7 +63,10 @@ async fn main() -> anyhow::Result<()> {
#[cfg(any(target_os = "linux", target_os = "windows"))]
{
warn!("Screenpipe hasn't been extensively tested on this OS. We'd love your feedback!");
- println!("{}", "Would love your feedback on the UX, let's a 15 min call soon:".bright_yellow());
+ println!(
+ "{}",
+ "Would love your feedback on the UX, let's a 15 min call soon:".bright_yellow()
+ );
println!(
"{}",
"https://cal.com/louis030195/screenpipe"