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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
restore headed mode for consumer installs (#5577)
Ezra Elletted0a02e92e9fd
diff --git a/apps/screenpipe-app-tauri/components/settings/general-settings.tsx b/apps/screenpipe-app-tauri/components/settings/general-settings.tsxindex 940b17c61..f16b37404 100644--- a/apps/screenpipe-app-tauri/components/settings/general-settings.tsx+++ b/apps/screenpipe-app-tauri/components/settings/general-settings.tsx@@ -10,7 +10,7 @@ import { Switch } from "@/components/ui/switch";import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";import { Label } from "@/components/ui/label";import { Separator } from "@/components/ui/separator";-import { Rocket, Moon, Sun, Monitor, FlaskConical, ExternalLink, Layers, RefreshCw, MonitorOff } from "lucide-react";+import { Rocket, Moon, Sun, Monitor, FlaskConical, ExternalLink, Layers, RefreshCw } from "lucide-react";import { useToast } from "@/components/ui/use-toast";import { Button } from "@/components/ui/button";import {@@ -42,8 +42,6 @@ export const searchIndex: SettingsField[] = [{ label: "Auto-Update Pipes" },{ label: "Reset Onboarding", keywords: ["setup"] },{ label: "Your goal", keywords: ["onboarding", "purpose", "personalization"] },- { label: "Headless", keywords: ["low resource", "tray only", "memory", "webview"] },- { label: "Record only", keywords: ["headless", "pipes", "scheduler", "automation"] },];import { useManagedPolicy } from "@/lib/hooks/use-managed-policy";import { screenpipeWebUrl } from "@/lib/web-url";@@ -444,49 +442,6 @@ export default function GeneralSettings() {</CardContent></Card>- <Card className="border-border bg-card" data-testid="headless-setting">- <CardContent className="px-3 py-2.5">- <div className="flex items-center justify-between">- <div className="flex items-center space-x-2.5">- <MonitorOff className="h-4 w-4 text-muted-foreground shrink-0" />- <div>- <h3 className="text-sm font-medium text-foreground">Headless</h3>- <p className="text-xs text-muted-foreground">- Close the app UI completely while recording continues in the tray- </p>- <p className="text-[10px] text-muted-foreground/60 mt-0.5">- App shortcuts and the UI are unavailable until you open screenpipe from the tray.- </p>- </div>- </div>- <Switch- id="headless-toggle"- checked={settings?.headless ?? false}- onCheckedChange={(checked) => handleSettingsChange({ headless: checked })}- className="ml-4"- />- </div>- {settings?.headless && (- <div className="ml-6 mt-2 border-l border-border pl-3 pt-2 flex items-center justify-between">- <div>- <h4 className="text-xs font-medium text-foreground">Record only</h4>- <p className="text-[10px] text-muted-foreground mt-0.5">- Skip scheduled pipe runs while the UI is headless- </p>- </div>- <Switch- id="headless-record-only-toggle"- checked={settings?.headlessRecordOnly ?? false}- onCheckedChange={(checked) =>- handleSettingsChange({ headlessRecordOnly: checked })- }- className="ml-4"- />- </div>- )}- </CardContent>- </Card>-</div>);}diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rsindex 9b7533678..edb8a8949 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs@@ -1845,6 +1845,25 @@ impl SettingsStore {}}+/// Consumer builds no longer support the legacy tray-only UI preference. Reset+/// both fields together so installs that used it reopen headed and resume their+/// normal scheduled-pipe behavior on the first launch after upgrading.+///+/// Enterprise builds retain the fields because a managed deployment may still+/// use the dormant-UI lifecycle independently of the consumer settings page.+fn restore_headed_mode_for_consumer(+ settings: &mut SettingsStore,+ is_enterprise_build: bool,+) -> bool {+ if is_enterprise_build || (!settings.headless && !settings.headless_record_only) {+ return false;+ }++ settings.headless = false;+ settings.headless_record_only = false;+ true+}+pub fn init_store(app: &AppHandle) -> Result<SettingsStore, String> {println!("Initializing settings store");@@ -1954,6 +1973,13 @@ pub fn init_store(app: &AppHandle) -> Result<SettingsStore, String> {}}+ if restore_headed_mode_for_consumer(&mut store, cfg!(feature = "enterprise-build")) {+ tracing::info!(+ "settings migration: restored headed UI and scheduled pipe runs for consumer install"+ );+ should_save = true;+ }+if should_save {if let Err(e) = store.save(app) {// Non-fatal — logged as warn (not error) so Sentry doesn't pick it up.@@ -2162,6 +2188,29 @@ mod tests {assert!(settings.headless_record_only);}+ #[test]+ fn consumer_headless_migration_restores_headed_mode() {+ let mut consumer = SettingsStore {+ headless: true,+ headless_record_only: true,+ ..Default::default()+ };++ assert!(restore_headed_mode_for_consumer(&mut consumer, false));+ assert!(!consumer.headless);+ assert!(!consumer.headless_record_only);+ assert!(!restore_headed_mode_for_consumer(&mut consumer, false));++ let mut enterprise = SettingsStore {+ headless: true,+ headless_record_only: true,+ ..Default::default()+ };+ assert!(!restore_headed_mode_for_consumer(&mut enterprise, true));+ assert!(enterprise.headless);+ assert!(enterprise.headless_record_only);+ }+#[test]fn remote_log_collection_defaults_to_disabled() {assert!(!SettingsStore::default().remote_log_collection_enabled);