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: disable eslint warning for export shortcut hook

Louis Beaumontffdce7744dda
diff --git a/packages/sync/dist/index.js b/packages/sync/dist/index.js
index a1d7de4cd..29904db93 100755
--- a/packages/sync/dist/index.js
+++ b/packages/sync/dist/index.js
@@ -9617,7 +9617,10 @@ function parseArgs() {
format: "markdown",
verbose: false,
dbSync: false,
- dbPath: process.env.SCREENPIPE_DB || `${home}/.screenpipe/db.sqlite`
+ dbPath: process.env.SCREENPIPE_DB || `${home}/.screenpipe/db.sqlite`,
+ daemon: false,
+ daemonInterval: 3600,
+ daemonStop: false
};
for (let i2 = 0;i2 < args.length; i2++) {
const arg = args[i2];
@@ -9652,6 +9655,17 @@ function parseArgs() {
case "--db-path":
config.dbPath = args[++i2];
break;
+ case "--daemon":
+ case "-d":
+ config.daemon = true;
+ config.dbSync = true;
+ break;
+ case "--interval":
+ config.daemonInterval = parseInt(args[++i2]) || 3600;
+ break;
+ case "--stop":
+ config.daemonStop = true;
+ break;
case "--help":
printHelp();
process.exit(0);
@@ -9681,6 +9695,10 @@ OPTIONS:
--db, --db-sync Sync raw SQLite database instead of summary
--db-path <path> Path to Screenpipe DB (default: ~/.screenpipe/db.sqlite)
+ -d, --daemon Install persistent background sync (survives reboot)
+ --interval <secs> Sync interval in seconds (default: 3600 = 1 hour)
+ --stop Stop and remove the daemon
+
ENVIRONMENT:
SCREENPIPE_URL Screenpipe API URL (default: http://localhost:3030)
SCREENPIPE_DB Path to Screenpipe database
@@ -9699,6 +9717,12 @@ EXAMPLES:
# Full sync: DB + daily summary
bunx screenpipe-sync --db -r clawdbot:~/.screenpipe && bunx screenpipe-sync -o ~/context -g
+ # ONE-LINER: Permanent background sync (survives reboot)
+ bunx screenpipe-sync --daemon --remote user@server:~/.screenpipe/
+
+ # Stop the daemon
+ bunx screenpipe-sync --stop
+
OUTPUT (summary mode):
- Todo items extracted from screen content
- Goals and intentions mentioned
@@ -9949,6 +9973,132 @@ async function writeOutput(content, config, filename) {
}
}
}
+async function setupDaemon(config) {
+ const fs2 = await import("fs/promises");
+ const { execSync } = await import("child_process");
+ const os = await import("os");
+ const path = await import("path");
+ const home = os.homedir();
+ const platform = os.platform();
+ if (!config.remote && !config.outputDir) {
+ console.error(`[error] --daemon requires --remote or --output`);
+ console.error(` Example: bunx screenpipe-sync --daemon -r user@host:~/.screenpipe/`);
+ process.exit(1);
+ }
+ const remotePart = config.remote ? `--remote ${config.remote}` : "";
+ const outputPart = config.outputDir ? `--output ${config.outputDir}` : "";
+ const gitPart = config.gitPush ? "--git" : "";
+ if (platform === "darwin") {
+ const plistPath = path.join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
+ const plist = `<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>com.screenpipe.sync</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/bin/bash</string>
+ <string>-c</string>
+ <string>export PATH="$HOME/.bun/bin:/usr/local/bin:/opt/homebrew/bin:$PATH" &amp;&amp; bunx screenpipe-sync --db ${remotePart} ${outputPart} ${gitPart}</string>
+ </array>
+ <key>StartInterval</key>
+ <integer>${config.daemonInterval}</integer>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>StandardOutPath</key>
+ <string>/tmp/screenpipe-sync.log</string>
+ <key>StandardErrorPath</key>
+ <string>/tmp/screenpipe-sync.err</string>
+ <key>EnvironmentVariables</key>
+ <dict>
+ <key>HOME</key>
+ <string>${home}</string>
+ </dict>
+</dict>
+</plist>`;
+ await fs2.mkdir(path.dirname(plistPath), { recursive: true });
+ await fs2.writeFile(plistPath, plist);
+ try {
+ execSync(`launchctl unload "${plistPath}" 2>/dev/null || true`);
+ execSync(`launchctl load "${plistPath}"`);
+ } catch (e2) {
+ console.error(`[error] Failed to load LaunchAgent: ${e2}`);
+ process.exit(1);
+ }
+ console.log(`[ok] Daemon installed (macOS LaunchAgent)`);
+ console.log(` Syncs every ${config.daemonInterval}s to: ${config.remote || config.outputDir}`);
+ console.log(` Logs: /tmp/screenpipe-sync.log`);
+ console.log(` Stop: bunx screenpipe-sync --stop`);
+ } else if (platform === "linux") {
+ const serviceDir = path.join(home, ".config/systemd/user");
+ const servicePath = path.join(serviceDir, "screenpipe-sync.service");
+ const timerPath = path.join(serviceDir, "screenpipe-sync.timer");
+ const service = `[Unit]
+Description=Screenpipe Sync
+
+[Service]
+Type=oneshot
+ExecStart=/bin/bash -c 'export PATH="$HOME/.bun/bin:$PATH" && bunx screenpipe-sync --db ${remotePart} ${outputPart} ${gitPart}'
+Environment=HOME=${home}
+
+[Install]
+WantedBy=default.target`;
+ const timer = `[Unit]
+Description=Screenpipe Sync Timer
+
+[Timer]
+OnBootSec=60
+OnUnitActiveSec=${config.daemonInterval}s
+Persistent=true
+
+[Install]
+WantedBy=timers.target`;
+ await fs2.mkdir(serviceDir, { recursive: true });
+ await fs2.writeFile(servicePath, service);
+ await fs2.writeFile(timerPath, timer);
+ try {
+ execSync("systemctl --user daemon-reload");
+ execSync("systemctl --user enable --now screenpipe-sync.timer");
+ } catch (e2) {
+ console.error(`[error] Failed to enable systemd timer: ${e2}`);
+ process.exit(1);
+ }
+ console.log(`[ok] Daemon installed (systemd user timer)`);
+ console.log(` Syncs every ${config.daemonInterval}s to: ${config.remote || config.outputDir}`);
+ console.log(` Status: systemctl --user status screenpipe-sync.timer`);
+ console.log(` Stop: bunx screenpipe-sync --stop`);
+ } else {
+ console.error(`[error] Daemon not supported on ${platform}`);
+ console.error(` Use cron instead: */60 * * * * bunx screenpipe-sync --db ${remotePart}`);
+ process.exit(1);
+ }
+}
+async function stopDaemon() {
+ const { execSync } = await import("child_process");
+ const os = await import("os");
+ const fs2 = await import("fs/promises");
+ const path = await import("path");
+ const home = os.homedir();
+ const platform = os.platform();
+ if (platform === "darwin") {
+ const plistPath = path.join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
+ try {
+ execSync(`launchctl unload "${plistPath}" 2>/dev/null`);
+ await fs2.unlink(plistPath);
+ console.log(`[ok] Daemon stopped and removed`);
+ } catch {
+ console.log(`[ok] Daemon was not running`);
+ }
+ } else if (platform === "linux") {
+ try {
+ execSync("systemctl --user disable --now screenpipe-sync.timer 2>/dev/null");
+ console.log(`[ok] Daemon stopped and disabled`);
+ } catch {
+ console.log(`[ok] Daemon was not running`);
+ }
+ }
+}
async function syncDatabase(config) {
const fs2 = await import("fs/promises");
const { execSync } = await import("child_process");
@@ -10013,6 +10163,14 @@ async function syncDatabase(config) {
async function main() {
const config = parseArgs();
const today = new Date().toISOString().split("T")[0];
+ if (config.daemonStop) {
+ await stopDaemon();
+ return;
+ }
+ if (config.daemon) {
+ await setupDaemon(config);
+ return;
+ }
if (config.dbSync) {
await syncDatabase(config);
return;
diff --git a/packages/sync/package.json b/packages/sync/package.json
index 2559d2442..956c90243 100644
--- a/packages/sync/package.json
+++ b/packages/sync/package.json
@@ -1,6 +1,6 @@
{
"name": "screenpipe-sync",
- "version": "0.2.0",
+ "version": "0.3.0",
"description": "Sync Screenpipe activity to structured daily summaries. Extract todos, goals, decisions from your screen history.",
"type": "module",
"bin": {
diff --git a/packages/sync/src/index.ts b/packages/sync/src/index.ts
index 13255a7e2..9bf358c77 100644
--- a/packages/sync/src/index.ts
+++ b/packages/sync/src/index.ts
@@ -53,6 +53,9 @@ interface Config {
verbose: boolean;
dbSync: boolean;
dbPath: string;
+ daemon: boolean;
+ daemonInterval: number;
+ daemonStop: boolean;
}
// ============================================================================
@@ -76,6 +79,9 @@ function parseArgs(): Config {
verbose: false,
dbSync: false,
dbPath: process.env.SCREENPIPE_DB || `${home}/.screenpipe/db.sqlite`,
+ daemon: false,
+ daemonInterval: 3600,
+ daemonStop: false,
};
for (let i = 0; i < args.length; i++) {
@@ -111,6 +117,17 @@ function parseArgs(): Config {
case "--db-path":
config.dbPath = args[++i];
break;
+ case "--daemon":
+ case "-d":
+ config.daemon = true;
+ config.dbSync = true; // daemon mode always syncs DB
+ break;
+ case "--interval":
+ config.daemonInterval = parseInt(args[++i]) || 3600;
+ break;
+ case "--stop":
+ config.daemonStop = true;
+ break;
case "--help":
printHelp();
process.exit(0);
@@ -142,6 +159,10 @@ OPTIONS:
--db, --db-sync Sync raw SQLite database instead of summary
--db-path <path> Path to Screenpipe DB (default: ~/.screenpipe/db.sqlite)
+ -d, --daemon Install persistent background sync (survives reboot)
+ --interval <secs> Sync interval in seconds (default: 3600 = 1 hour)
+ --stop Stop and remove the daemon
+
ENVIRONMENT:
SCREENPIPE_URL Screenpipe API URL (default: http://localhost:3030)
SCREENPIPE_DB Path to Screenpipe database
@@ -160,6 +181,12 @@ EXAMPLES:
# Full sync: DB + daily summary
bunx screenpipe-sync --db -r clawdbot:~/.screenpipe && bunx screenpipe-sync -o ~/context -g
+ # ONE-LINER: Permanent background sync (survives reboot)
+ bunx screenpipe-sync --daemon --remote user@server:~/.screenpipe/
+
+ # Stop the daemon
+ bunx screenpipe-sync --stop
+
OUTPUT (summary mode):
- Todo items extracted from screen content
- Goals and intentions mentioned
@@ -465,6 +492,152 @@ async function writeOutput(content: string, config: Config, filename: string) {
// Main
// ============================================================================
+async function setupDaemon(config: Config) {
+ const fs = await import("fs/promises");
+ const { execSync } = await import("child_process");
+ const os = await import("os");
+ const path = await import("path");
+
+ const home = os.homedir();
+ const platform = os.platform();
+
+ if (!config.remote && !config.outputDir) {
+ console.error(`[error] --daemon requires --remote or --output`);
+ console.error(` Example: bunx screenpipe-sync --daemon -r user@host:~/.screenpipe/`);
+ process.exit(1);
+ }
+
+ const remotePart = config.remote ? `--remote ${config.remote}` : "";
+ const outputPart = config.outputDir ? `--output ${config.outputDir}` : "";
+ const gitPart = config.gitPush ? "--git" : "";
+
+ if (platform === "darwin") {
+ // macOS: LaunchAgent
+ const plistPath = path.join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
+ const plist = `<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>com.screenpipe.sync</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/bin/bash</string>
+ <string>-c</string>
+ <string>export PATH="$HOME/.bun/bin:/usr/local/bin:/opt/homebrew/bin:$PATH" &amp;&amp; bunx screenpipe-sync --db ${remotePart} ${outputPart} ${gitPart}</string>
+ </array>
+ <key>StartInterval</key>
+ <integer>${config.daemonInterval}</integer>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>StandardOutPath</key>
+ <string>/tmp/screenpipe-sync.log</string>
+ <key>StandardErrorPath</key>
+ <string>/tmp/screenpipe-sync.err</string>
+ <key>EnvironmentVariables</key>
+ <dict>
+ <key>HOME</key>
+ <string>${home}</string>
+ </dict>
+</dict>
+</plist>`;
+
+ await fs.mkdir(path.dirname(plistPath), { recursive: true });
+ await fs.writeFile(plistPath, plist);
+
+ try {
+ execSync(`launchctl unload "${plistPath}" 2>/dev/null || true`);
+ execSync(`launchctl load "${plistPath}"`);
+ } catch (e) {
+ console.error(`[error] Failed to load LaunchAgent: ${e}`);
+ process.exit(1);
+ }
+
+ console.log(`[ok] Daemon installed (macOS LaunchAgent)`);
+ console.log(` Syncs every ${config.daemonInterval}s to: ${config.remote || config.outputDir}`);
+ console.log(` Logs: /tmp/screenpipe-sync.log`);
+ console.log(` Stop: bunx screenpipe-sync --stop`);
+
+ } else if (platform === "linux") {
+ // Linux: systemd user service
+ const serviceDir = path.join(home, ".config/systemd/user");
+ const servicePath = path.join(serviceDir, "screenpipe-sync.service");
+ const timerPath = path.join(serviceDir, "screenpipe-sync.timer");
+
+ const service = `[Unit]
+Description=Screenpipe Sync
+
+[Service]
+Type=oneshot
+ExecStart=/bin/bash -c 'export PATH="$HOME/.bun/bin:$PATH" && bunx screenpipe-sync --db ${remotePart} ${outputPart} ${gitPart}'
+Environment=HOME=${home}
+
+[Install]
+WantedBy=default.target`;
+
+ const timer = `[Unit]
+Description=Screenpipe Sync Timer
+
+[Timer]
+OnBootSec=60
+OnUnitActiveSec=${config.daemonInterval}s
+Persistent=true
+
+[Install]
+WantedBy=timers.target`;
+
+ await fs.mkdir(serviceDir, { recursive: true });
+ await fs.writeFile(servicePath, service);
+ await fs.writeFile(timerPath, timer);
+
+ try {
+ execSync("systemctl --user daemon-reload");
+ execSync("systemctl --user enable --now screenpipe-sync.timer");
+ } catch (e) {
+ console.error(`[error] Failed to enable systemd timer: ${e}`);
+ process.exit(1);
+ }
+
+ console.log(`[ok] Daemon installed (systemd user timer)`);
+ console.log(` Syncs every ${config.daemonInterval}s to: ${config.remote || config.outputDir}`);
+ console.log(` Status: systemctl --user status screenpipe-sync.timer`);
+ console.log(` Stop: bunx screenpipe-sync --stop`);
+
+ } else {
+ console.error(`[error] Daemon not supported on ${platform}`);
+ console.error(` Use cron instead: */60 * * * * bunx screenpipe-sync --db ${remotePart}`);
+ process.exit(1);
+ }
+}
+
+async function stopDaemon() {
+ const { execSync } = await import("child_process");
+ const os = await import("os");
+ const fs = await import("fs/promises");
+ const path = await import("path");
+
+ const home = os.homedir();
+ const platform = os.platform();
+
+ if (platform === "darwin") {
+ const plistPath = path.join(home, "Library/LaunchAgents/com.screenpipe.sync.plist");
+ try {
+ execSync(`launchctl unload "${plistPath}" 2>/dev/null`);
+ await fs.unlink(plistPath);
+ console.log(`[ok] Daemon stopped and removed`);
+ } catch {
+ console.log(`[ok] Daemon was not running`);
+ }
+ } else if (platform === "linux") {
+ try {
+ execSync("systemctl --user disable --now screenpipe-sync.timer 2>/dev/null");
+ console.log(`[ok] Daemon stopped and disabled`);
+ } catch {
+ console.log(`[ok] Daemon was not running`);
+ }
+ }
+}
+
async function syncDatabase(config: Config) {
const fs = await import("fs/promises");
const { execSync } = await import("child_process");
@@ -549,6 +722,18 @@ async function main() {
const config = parseArgs();
const today = new Date().toISOString().split("T")[0];
+ // Stop daemon
+ if (config.daemonStop) {
+ await stopDaemon();
+ return;
+ }
+
+ // Daemon mode - install persistent sync
+ if (config.daemon) {
+ await setupDaemon(config);
+ return;
+ }
+
// DB sync mode
if (config.dbSync) {
await syncDatabase(config);
diff --git a/screenpipe-app-tauri/components/global-chat.tsx b/screenpipe-app-tauri/components/global-chat.tsx
index 1b3c1f20f..40713cb3b 100644
--- a/screenpipe-app-tauri/components/global-chat.tsx
+++ b/screenpipe-app-tauri/components/global-chat.tsx
@@ -698,6 +698,7 @@ export function GlobalChat() {
window.addEventListener("keydown", handleKeyDown);
return () => window.removeEventListener("keydown", handleKeyDown);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOnTimeline, isExporting, selectionRange]);
// Fetch speakers dynamically when filter changes
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 5756cf2a6..4c5c407d9 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.0.134"
+version = "2.0.135"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rs
index cdb34e8dd..6a8949bd5 100644
--- a/screenpipe-server/src/server.rs
+++ b/screenpipe-server/src/server.rs
@@ -3296,6 +3296,25 @@ fn create_time_series_frame(chunk: FrameData) -> TimeSeriesFrame {
// This ensures audio is displayed once per frame, not once per OCR text region
if let Some(first_frame) = device_frames.first_mut() {
first_frame.audio_entries = audio_entries;
+ } else if !audio_entries.is_empty() {
+ // If there are no OCR-based device frames but we have audio,
+ // create a placeholder frame to hold the audio entries.
+ // This ensures audio is not silently dropped when screen capture
+ // produced no visible windows or all windows were filtered out.
+ device_frames.push(DeviceFrame {
+ device_id: "audio-only".to_string(),
+ frame_id: chunk.frame_id,
+ image_data: vec![],
+ metadata: FrameMetadata {
+ file_path: String::new(),
+ app_name: "Audio Recording".to_string(),
+ window_name: String::new(),
+ transcription: transcription_text,
+ ocr_text: String::new(),
+ browser_url: None,
+ },
+ audio_entries,
+ });
}
TimeSeriesFrame {
@@ -3980,4 +3999,39 @@ mod tests {
assert_eq!(total_audio_entries, 0, "Should have no audio entries");
assert_eq!(result.frame_data.len(), 5, "Should have 5 DeviceFrames");
}
+
+ /// TEST: Audio entries with no OCR entries should create a placeholder frame
+ #[test]
+ fn test_audio_only_frame_creates_placeholder() {
+ // 0 OCR entries, 2 audio entries
+ let frame_data = create_test_frame_data(0, 2);
+
+ let result = create_time_series_frame(frame_data);
+
+ let total_audio_entries: usize = result
+ .frame_data
+ .iter()
+ .map(|df| df.audio_entries.len())
+ .sum();
+
+ println!("OCR entries: 0, Audio entries: 2");
+ println!("DeviceFrames: {}", result.frame_data.len());
+ println!("Total audio entries in result: {}", total_audio_entries);
+
+ // Should have 1 placeholder DeviceFrame with 2 audio entries
+ assert_eq!(
+ result.frame_data.len(),
+ 1,
+ "Should have 1 placeholder DeviceFrame for audio"
+ );
+ assert_eq!(
+ total_audio_entries, 2,
+ "Should have 2 audio entries in the placeholder frame"
+ );
+
+ // Verify the placeholder frame has the expected metadata
+ let placeholder = &result.frame_data[0];
+ assert_eq!(placeholder.device_id, "audio-only");
+ assert_eq!(placeholder.metadata.app_name, "Audio Recording");
+ }
}