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

add autostart toggle (#1449)

hunny warisuff7be38da9c4
diff --git a/screenpipe-app-tauri/components/recording-settings.tsx b/screenpipe-app-tauri/components/recording-settings.tsx
index 96667d550..43cb69f1f 100644
--- a/screenpipe-app-tauri/components/recording-settings.tsx
+++ b/screenpipe-app-tauri/components/recording-settings.tsx
@@ -434,6 +434,11 @@ export function RecordingSettings() {
handleSettingsChange({ analyticsEnabled: newValue });
};
+ const handleAutoStartToggle = async (checked: boolean) => {
+ const newValue = checked
+ handleSettingsChange({ autoStartEnabled: newValue});
+ }
+
const handleChineseMirrorToggle = async (checked: boolean) => {
handleSettingsChange({ useChineseMirror: checked });
if (checked) {
@@ -1479,6 +1484,20 @@ export function RecordingSettings() {
/>
</div>
+ <div className="flex items-center justify-between">
+ <div className="space-y-1">
+ <h4 className="font-medium">enable autostart</h4>
+ <p className="text-sm text-muted-foreground">
+ automatically launch Screenpipe at startup
+ </p>
+ </div>
+ <Switch
+ id="auto-start-toggle"
+ checked={settings.autoStartEnabled}
+ onCheckedChange={handleAutoStartToggle}
+ />
+ </div>
+
{isMacOS && (
<div className="flex items-center justify-between">
<div className="space-y-1">
diff --git a/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index e57302641..ca41ed1f8 100644
--- a/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -89,6 +89,7 @@ export type Settings = {
languages: Language[];
enableBeta: boolean;
isFirstTimeUser: boolean;
+ autoStartEnabled: boolean
enableFrameCache: boolean; // Add this line
enableUiMonitoring: boolean; // Add this line
platform: string; // Add this line
@@ -148,6 +149,7 @@ const DEFAULT_SETTINGS: Settings = {
},
enableBeta: false,
isFirstTimeUser: true,
+ autoStartEnabled: true,
enableFrameCache: true, // Add this line
enableUiMonitoring: false, // Change from true to false
platform: "unknown", // Add this line
diff --git a/screenpipe-app-tauri/src-tauri/gen/schemas/linux-schema.json b/screenpipe-app-tauri/src-tauri/gen/schemas/linux-schema.json
index e146741aa..9bf4e459c 100644
--- a/screenpipe-app-tauri/src-tauri/gen/schemas/linux-schema.json
+++ b/screenpipe-app-tauri/src-tauri/gen/schemas/linux-schema.json
@@ -1753,6 +1753,166 @@
}
}
},
+ {
+ "if": {
+ "properties": {
+ "identifier": {
+ "anyOf": [
+ {
+ "description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer",
+ "type": "string",
+ "const": "opener:default"
+ },
+ {
+ "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.",
+ "type": "string",
+ "const": "opener:allow-default-urls"
+ },
+ {
+ "description": "Enables the open_path command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:allow-open-path"
+ },
+ {
+ "description": "Enables the open_url command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:allow-open-url"
+ },
+ {
+ "description": "Enables the reveal_item_in_dir command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:allow-reveal-item-in-dir"
+ },
+ {
+ "description": "Denies the open_path command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:deny-open-path"
+ },
+ {
+ "description": "Denies the open_url command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:deny-open-url"
+ },
+ {
+ "description": "Denies the reveal_item_in_dir command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:deny-reveal-item-in-dir"
+ }
+ ]
+ }
+ }
+ },
+ "then": {
+ "properties": {
+ "allow": {
+ "items": {
+ "title": "OpenerScopeEntry",
+ "description": "Opener scope entry.",
+ "anyOf": [
+ {
+ "type": "object",
+ "required": [
+ "url"
+ ],
+ "properties": {
+ "app": {
+ "description": "An application to open this url with, for example: firefox.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Application"
+ }
+ ]
+ },
+ "url": {
+ "description": "A URL that can be opened by the webview when using the Opener APIs.\n\nWildcards can be used following the UNIX glob pattern.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
+ "type": "string"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "path"
+ ],
+ "properties": {
+ "app": {
+ "description": "An application to open this path with, for example: xdg-open.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Application"
+ }
+ ]
+ },
+ "path": {
+ "description": "A path that can be opened by the webview when using the Opener APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "deny": {
+ "items": {
+ "title": "OpenerScopeEntry",
+ "description": "Opener scope entry.",
+ "anyOf": [
+ {
+ "type": "object",
+ "required": [
+ "url"
+ ],
+ "properties": {
+ "app": {
+ "description": "An application to open this url with, for example: firefox.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Application"
+ }
+ ]
+ },
+ "url": {
+ "description": "A URL that can be opened by the webview when using the Opener APIs.\n\nWildcards can be used following the UNIX glob pattern.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
+ "type": "string"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "path"
+ ],
+ "properties": {
+ "app": {
+ "description": "An application to open this path with, for example: xdg-open.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Application"
+ }
+ ]
+ },
+ "path": {
+ "description": "A path that can be opened by the webview when using the Opener APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "properties": {
+ "identifier": {
+ "description": "Identifier of the permission or permission set.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Identifier"
+ }
+ ]
+ }
+ }
+ },
{
"if": {
"properties": {
@@ -5319,6 +5479,46 @@
"type": "string",
"const": "notification:deny-show"
},
+ {
+ "description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer",
+ "type": "string",
+ "const": "opener:default"
+ },
+ {
+ "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.",
+ "type": "string",
+ "const": "opener:allow-default-urls"
+ },
+ {
+ "description": "Enables the open_path command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:allow-open-path"
+ },
+ {
+ "description": "Enables the open_url command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:allow-open-url"
+ },
+ {
+ "description": "Enables the reveal_item_in_dir command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:allow-reveal-item-in-dir"
+ },
+ {
+ "description": "Denies the open_path command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:deny-open-path"
+ },
+ {
+ "description": "Denies the open_url command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:deny-open-url"
+ },
+ {
+ "description": "Denies the reveal_item_in_dir command without any pre-configured scope.",
+ "type": "string",
+ "const": "opener:deny-reveal-item-in-dir"
+ },
{
"description": "This permission set configures which\noperating system information are available\nto gather from the frontend.\n\n#### Granted Permissions\n\nAll information except the host name are available.\n\n",
"type": "string",
@@ -5805,6 +6005,23 @@
}
]
},
+ "Application": {
+ "description": "Opener scope application.",
+ "anyOf": [
+ {
+ "description": "Open in default application.",
+ "type": "null"
+ },
+ {
+ "description": "If true, allow open with any application.",
+ "type": "boolean"
+ },
+ {
+ "description": "Allow specific application to open with.",
+ "type": "string"
+ }
+ ]
+ },
"ShellScopeEntryAllowedArg": {
"description": "A command argument allowed to be executed by the webview API.",
"anyOf": [
diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rs
index 7a1110c32..89f22123b 100755
--- a/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -745,11 +745,6 @@ async fn main() {
// Autostart setup
let autostart_manager = app.autolaunch();
- let _ = autostart_manager.enable();
- debug!(
- "registered for autostart? {}",
- autostart_manager.is_enabled().unwrap()
- );
info!("Local data directory: {}", base_dir.display());
@@ -799,6 +794,23 @@ async fn main() {
.unwrap_or(Value::Bool(true))
.as_bool()
.unwrap_or(true);
+
+ let is_autostart_enabled = store
+ .get("autoStartEnabled")
+ .unwrap_or(Value::Bool(true))
+ .as_bool()
+ .unwrap_or(true);
+
+ if is_autostart_enabled {
+ let _ = autostart_manager.enable();
+ } else {
+ let _ = autostart_manager.disable();
+ }
+
+ debug!(
+ "registered for autostart? {}",
+ autostart_manager.is_enabled().unwrap()
+ );
let unique_id = store
.get("user.id")