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(updates): auto-update by default, with tray toggle

Louis Beaumont63422e71606e
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
index 45e4e4144..79412266a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
@@ -203,6 +203,10 @@ pub struct SettingsStore {
/// Requires accessibility and input monitoring permissions on macOS.
#[serde(rename = "enableUiEvents", default)]
pub enable_ui_events: bool,
+ /// Auto-install updates and restart when a new version is available.
+ /// When disabled, users must click "update now" in the tray menu.
+ #[serde(rename = "autoUpdate", default = "default_true")]
+ pub auto_update: bool,
}
fn generate_device_id() -> String {
@@ -483,6 +487,7 @@ impl Default for SettingsStore {
device_id: uuid::Uuid::new_v4().to_string(),
adaptive_fps: false,
enable_ui_events: false,
+ auto_update: true,
}
}
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
index e9ff773f9..98e5f331a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
@@ -1,7 +1,7 @@
use crate::commands::show_main_window;
use crate::health::{get_recording_status, RecordingStatus};
use crate::recording::RecordingState;
-use crate::store::{get_store, OnboardingStore};
+use crate::store::{get_store, OnboardingStore, SettingsStore};
use crate::updates::is_source_build;
use crate::window_api::ShowRewindWindow;
use anyhow::Result;
@@ -148,10 +148,23 @@ fn create_dynamic_menu(
.item(&MenuItemBuilder::with_id("stop_recording", "stop recording").build(app)?);
}
+ // Auto-update toggle
+ let auto_update_enabled = SettingsStore::get(app)
+ .ok()
+ .flatten()
+ .map(|s| s.auto_update)
+ .unwrap_or(true);
+ let auto_update_text = if auto_update_enabled {
+ "✓ auto-update"
+ } else {
+ " auto-update"
+ };
+
// Settings, feedback and quit
menu_builder = menu_builder
.item(&PredefinedMenuItem::separator(app)?)
.item(&MenuItemBuilder::with_id("settings", "settings").build(app)?)
+ .item(&MenuItemBuilder::with_id("toggle_auto_update", auto_update_text).build(app)?)
.item(&MenuItemBuilder::with_id("feedback", "send feedback").build(app)?)
.item(&MenuItemBuilder::with_id("book_call", "book a call with founder").build(app)?)
.item(&MenuItemBuilder::with_id("onboarding", "onboarding").build(app)?)
@@ -236,6 +249,22 @@ fn handle_menu_event(app_handle: &AppHandle, event: tauri::menu::MenuEvent) {
"settings" => {
let _ = ShowRewindWindow::Settings { page: None }.show(app_handle);
}
+ "toggle_auto_update" => {
+ let current = SettingsStore::get(app_handle)
+ .ok()
+ .flatten()
+ .map(|s| s.auto_update)
+ .unwrap_or(true);
+ let new_value = !current;
+
+ // Update the store
+ if let Ok(store) = get_store(app_handle, None) {
+ let _ = store.set("autoUpdate", serde_json::json!(new_value));
+ let _ = store.save();
+ }
+
+ info!("auto-update toggled to: {}", new_value);
+ }
"feedback" => {
let _ = ShowRewindWindow::Settings { page: Some("feedback".to_string()) }.show(app_handle);
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/updates.rs b/apps/screenpipe-app-tauri/src-tauri/src/updates.rs
index fa77a597f..bcc9507d6 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/updates.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/updates.rs
@@ -1,4 +1,5 @@
use crate::stop_screenpipe;
+use crate::store::SettingsStore;
use crate::RecordingState;
use anyhow::Error;
use dark_light::Mode;
@@ -132,6 +133,29 @@ impl UpdatesManager {
error!("Failed to emit update-available event: {}", e);
}
+ // Auto-update: if enabled and update is downloaded, restart automatically
+ // This ensures users get updates even if tray icon is hidden (e.g., behind notch)
+ #[cfg(not(target_os = "windows"))]
+ {
+ let auto_update = SettingsStore::get(&self.app)
+ .ok()
+ .flatten()
+ .map(|s| s.auto_update)
+ .unwrap_or(true);
+
+ if auto_update && *self.update_installed.lock().await {
+ info!("auto-update enabled, restarting to apply update v{}", update.version);
+ // Brief delay so the user can see the notification
+ tokio::time::sleep(Duration::from_secs(3)).await;
+ if let Err(err) =
+ stop_screenpipe(self.app.state::<RecordingState>(), self.app.clone()).await
+ {
+ error!("Failed to stop recording before auto-update: {}", err);
+ }
+ self.app.restart();
+ }
+ }
+
if show_dialog {
let (tx, rx) = oneshot::channel();
let update_dialog = self