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

feat: add fps in recording settings

Louis Beaumont04ba4347a5a8
diff --git a/screenpipe-app-tauri/components/recording-settings.tsx b/screenpipe-app-tauri/components/recording-settings.tsx
index c6722ec68..5ed97ecce 100644
--- a/screenpipe-app-tauri/components/recording-settings.tsx
+++ b/screenpipe-app-tauri/components/recording-settings.tsx
@@ -41,6 +41,7 @@ import {
} from "./ui/tooltip";
import { Switch } from "./ui/switch";
import { Input } from "./ui/input";
+import { Slider } from "./ui/slider";
interface AudioDevice {
name: string;
@@ -164,6 +165,7 @@ export function RecordingSettings({
ignoredWindows: localSettings.ignoredWindows,
includedWindows: localSettings.includedWindows,
deepgramApiKey: localSettings.deepgramApiKey,
+ fps: localSettings.fps,
};
console.log("Settings to update:", settingsToUpdate);
await updateSettings(settingsToUpdate);
@@ -261,6 +263,10 @@ export function RecordingSettings({
setLocalSettings({ ...localSettings, disableAudio: checked });
};
+ const handleFpsChange = (value: number[]) => {
+ setLocalSettings({ ...localSettings, fps: value[0] });
+ };
+
return (
<>
<div className="relative">
@@ -271,7 +277,9 @@ export function RecordingSettings({
(go to status)
</CardTitle>
</Card>
- ) : <></>}
+ ) : (
+ <></>
+ )}
<Card className={cn(isDisabled && "opacity-50 pointer-events-none")}>
<CardHeader>
<CardTitle className="text-center">recording settings</CardTitle>
@@ -708,6 +716,42 @@ export function RecordingSettings({
</div>
</div>
+ <div className="flex flex-col space-y-2">
+ <Label htmlFor="fps" className="flex items-center space-x-2">
+ <span>frames per second (fps)</span>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger>
+ <HelpCircle className="h-4 w-4" />
+ </TooltipTrigger>
+ <TooltipContent side="right">
+ <p>
+ adjust the recording frame rate. lower values save
+ <br />
+ resources, higher values provide smoother recordings, less likely to miss activity.
+ <br />
+ (we do not use resources if your screen does not change much)
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </Label>
+ <div className="flex items-center space-x-4">
+ <Slider
+ id="fps"
+ min={0.1}
+ max={10}
+ step={0.1}
+ value={[localSettings.fps]}
+ onValueChange={handleFpsChange}
+ className="flex-grow"
+ />
+ <span className="w-12 text-right">
+ {localSettings.fps.toFixed(1)}
+ </span>
+ </div>
+ </div>
+
<div className="flex flex-col space-y-2">
<Button
onClick={handleUpdate}
diff --git a/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index 6cc81efc7..fdfc9775b 100644
--- a/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -36,6 +36,7 @@ const defaultSettings: Settings = {
includedWindows: [],
aiUrl: "https://api.openai.com/v1",
aiMaxContextChars: 30000,
+ fps: 0.5,
};
export interface Settings {
@@ -62,6 +63,7 @@ export interface Settings {
includedWindows: string[];
aiUrl: string;
aiMaxContextChars: number;
+ fps: number;
}
let store: Store | null = null;
@@ -107,7 +109,8 @@ export function useSettings() {
await store!.load();
const savedKey = ((await store!.get("openaiApiKey")) as string) || "";
const savedDeepgramKey =
- ((await store!.get("deepgramApiKey")) as string) || "7ed2a159a094337b01fd8178b914b7ae0e77822d";
+ ((await store!.get("deepgramApiKey")) as string) ||
+ "7ed2a159a094337b01fd8178b914b7ae0e77822d";
const savedUseOllama =
((await store!.get("useOllama")) as boolean) || false;
const savedOllamaUrl =
@@ -151,6 +154,9 @@ export function useSettings() {
"https://api.openai.com/v1";
const savedAiMaxContextChars =
((await store!.get("aiMaxContextChars")) as number) || 30000;
+ const savedFps =
+ ((await store!.get("fps")) as number) ||
+ (platform() === "macos" ? 0.2 : 1);
setSettings({
openaiApiKey: savedKey,
deepgramApiKey: savedDeepgramKey,
@@ -175,6 +181,7 @@ export function useSettings() {
includedWindows: savedIncludedWindows,
aiUrl: savedAiUrl,
aiMaxContextChars: savedAiMaxContextChars,
+ fps: savedFps,
});
} catch (error) {
console.error("Failed to load settings:", error);
diff --git a/screenpipe-app-tauri/src-tauri/src/sidecar.rs b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
index f4a1191c7..aeef74581 100644
--- a/screenpipe-app-tauri/src-tauri/src/sidecar.rs
+++ b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
@@ -173,11 +173,20 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
.map_err(|e| e.to_string())?
.unwrap_or(String::from("default"));
+ let fps = with_store(app.clone(), stores.clone(), path.clone(), |store| {
+ Ok(store
+ .get("fps")
+ .and_then(|v| v.as_f64())
+ .unwrap_or(0.5))
+ })
+ .map_err(|e| e.to_string())?;
+
let port_str = port.to_string();
let mut args = vec!["--port", port_str.as_str()];
- if cfg!(target_os = "macos") {
+ let fps_str = fps.to_string();
+ if fps != 0.5 {
args.push("--fps");
- args.push("0.2");
+ args.push(fps_str.as_str());
}
if data_dir != "default" {