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(app): platform-aware shortcut display and sidecar state management

louis030195d6b6640d0819
diff --git a/screenpipe-app-tauri/app/shortcut-reminder/page.tsx b/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
index 199c58e8f..ff6697d4a 100644
--- a/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
+++ b/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
@@ -3,14 +3,16 @@
import { useEffect, useState } from "react";
import { listen } from "@tauri-apps/api/event";
import posthog from "posthog-js";
+import { usePlatform } from "@/lib/hooks/use-platform";
export default function ShortcutReminderPage() {
- const [shortcut, setShortcut] = useState("⌘⌃S");
+ const { isMac } = usePlatform();
+ const [shortcut, setShortcut] = useState(isMac ? "⌘⌃S" : "Win+Ctrl+S");
const [hovered, setHovered] = useState(false);
useEffect(() => {
const unlistenShortcut = listen<string>("shortcut-reminder-update", (event) => {
- setShortcut(formatShortcut(event.payload));
+ setShortcut(formatShortcut(event.payload, isMac));
});
posthog.capture("shortcut_reminder_shown");
@@ -18,7 +20,7 @@ export default function ShortcutReminderPage() {
return () => {
unlistenShortcut.then((fn) => fn());
};
- }, []);
+ }, [isMac]);
return (
<div
@@ -76,12 +78,19 @@ export default function ShortcutReminderPage() {
);
}
-function formatShortcut(shortcut: string): string {
- if (!shortcut) return "⌘⌃S";
+function formatShortcut(shortcut: string, isMac: boolean): string {
+ if (!shortcut) return isMac ? "⌘⌃S" : "Win+Ctrl+S";
+ if (isMac) {
+ return shortcut
+ .replace(/Super|Command|Cmd/gi, "⌘")
+ .replace(/Ctrl|Control/gi, "⌃")
+ .replace(/Alt|Option/gi, "⌥")
+ .replace(/Shift/gi, "⇧")
+ .replace(/\+/g, "");
+ }
+ // Windows/Linux: use readable text
return shortcut
- .replace(/Super|Command|Cmd/gi, "⌘")
- .replace(/Ctrl|Control/gi, "⌃")
- .replace(/Alt|Option/gi, "⌥")
- .replace(/Shift/gi, "⇧")
- .replace(/\+/g, "");
+ .replace(/Super/gi, "Win")
+ .replace(/Command|Cmd/gi, "Ctrl")
+ .replace(/Option/gi, "Alt");
}
diff --git a/screenpipe-app-tauri/bun.lock b/screenpipe-app-tauri/bun.lock
index e6c600406..8d179c38a 100644
--- a/screenpipe-app-tauri/bun.lock
+++ b/screenpipe-app-tauri/bun.lock
@@ -80,7 +80,7 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
- "@tauri-apps/cli": "^2.4.1",
+ "@tauri-apps/cli": "^2.9.6",
"@types/js-levenshtein": "^1.1.3",
"@types/lodash": "^4.17.7",
"@types/node": "^20",
diff --git a/screenpipe-app-tauri/components/onboarding/status.tsx b/screenpipe-app-tauri/components/onboarding/status.tsx
index eaa19e865..69150771c 100644
--- a/screenpipe-app-tauri/components/onboarding/status.tsx
+++ b/screenpipe-app-tauri/components/onboarding/status.tsx
@@ -8,15 +8,22 @@ import { commands, type OSPermissionsCheck } from "@/lib/utils/tauri";
import { motion } from "framer-motion";
import { useSettings, DEFAULT_PROMPT } from "@/lib/hooks/use-settings";
-// Format shortcut for display
-function formatShortcut(shortcut: string): string {
+// Format shortcut for display (platform-aware)
+function formatShortcut(shortcut: string, isMac: boolean): string {
if (!shortcut) return "";
+ if (isMac) {
+ return shortcut
+ .replace(/Super|Command|Cmd/gi, "⌘")
+ .replace(/Ctrl|Control/gi, "⌃")
+ .replace(/Alt|Option/gi, "⌥")
+ .replace(/Shift/gi, "⇧")
+ .replace(/\+/g, " ");
+ }
+ // Windows/Linux: use readable text
return shortcut
- .replace(/Super|Command|Cmd/gi, "⌘")
- .replace(/Ctrl|Control/gi, "⌃")
- .replace(/Alt|Option/gi, "⌥")
- .replace(/Shift/gi, "⇧")
- .replace(/\+/g, " ");
+ .replace(/Super/gi, "Win")
+ .replace(/Command|Cmd/gi, "Ctrl")
+ .replace(/Option/gi, "Alt");
}
interface OnboardingStatusProps {
@@ -247,7 +254,7 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({
<p className="font-mono text-xs text-center text-muted-foreground">
press{" "}
<span className="font-semibold text-foreground">
- {formatShortcut(settings.showScreenpipeShortcut)}
+ {formatShortcut(settings.showScreenpipeShortcut, isMacOS)}
</span>{" "}
anytime to open screenpipe
</p>
diff --git a/screenpipe-app-tauri/components/shortcut-reminder.tsx b/screenpipe-app-tauri/components/shortcut-reminder.tsx
index 62495df07..9d4fcc945 100644
--- a/screenpipe-app-tauri/components/shortcut-reminder.tsx
+++ b/screenpipe-app-tauri/components/shortcut-reminder.tsx
@@ -36,14 +36,21 @@ export function ShortcutTracker() {
return null;
}
-// Format shortcut for display (e.g., "Super+Alt+S" -> "⌘ ⌥ S")
-export function formatShortcut(shortcut: string): string {
+// Format shortcut for display (platform-aware)
+export function formatShortcut(shortcut: string, isMac: boolean = true): string {
if (!shortcut) return "";
+ if (isMac) {
+ return shortcut
+ .replace(/Super|Command|Cmd/gi, "⌘")
+ .replace(/Ctrl|Control/gi, "⌃")
+ .replace(/Alt|Option/gi, "⌥")
+ .replace(/Shift/gi, "⇧")
+ .replace(/\+/g, " ");
+ }
+ // Windows/Linux: use readable text
return shortcut
- .replace(/Super|Command|Cmd/gi, "⌘")
- .replace(/Ctrl|Control/gi, "⌃")
- .replace(/Alt|Option/gi, "⌥")
- .replace(/Shift/gi, "⇧")
- .replace(/\+/g, " ");
+ .replace(/Super/gi, "Win")
+ .replace(/Command|Cmd/gi, "Ctrl")
+ .replace(/Option/gi, "Alt");
}
diff --git a/screenpipe-app-tauri/package.json b/screenpipe-app-tauri/package.json
index b2d19ae51..ced5fdb6c 100644
--- a/screenpipe-app-tauri/package.json
+++ b/screenpipe-app-tauri/package.json
@@ -88,7 +88,7 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
- "@tauri-apps/cli": "^2.4.1",
+ "@tauri-apps/cli": "^2.9.6",
"@types/js-levenshtein": "^1.1.3",
"@types/lodash": "^4.17.7",
"@types/node": "^20",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 134427fc7..ef07f4a96 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5629,7 +5629,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-app"
-version = "2.0.9"
+version = "2.0.10"
dependencies = [
"anyhow",
"async-stream",
diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rs
index 3e904dbcd..e99bb1369 100755
--- a/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -729,6 +729,7 @@ async fn main() {
}
let sidecar_state = SidecarState(Arc::new(tokio::sync::Mutex::new(None)));
+ let sidecar_state_for_init = sidecar_state.0.clone(); // Clone for initial spawn
#[allow(clippy::single_match)]
let app = tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
@@ -907,10 +908,6 @@ async fn main() {
let server_shutdown_tx = spawn_server(app_handle.clone(), 11435);
app.manage(server_shutdown_tx);
- // Initialize sidecar manager and check dev mode
- let sidecar_manager = Arc::new(Mutex::new(SidecarManager::new()));
- app.manage(sidecar_manager.clone());
-
// Dev mode check and sidecar initialization
let use_dev_mode = store
.dev_mode;
@@ -918,11 +915,17 @@ async fn main() {
info!("use_dev_mode: {}", use_dev_mode);
// Start sidecar in non-dev mode (production behavior)
+ // Uses the same SidecarState that tauri commands use
if !use_dev_mode {
- let sidecar_manager_clone = sidecar_manager.clone();
+ let sidecar_state_clone = sidecar_state_for_init.clone();
let app_handle_clone = app_handle.clone();
tauri::async_runtime::spawn(async move {
- let mut manager = sidecar_manager_clone.lock().await;
+ let mut state_guard = sidecar_state_clone.lock().await;
+ // Initialize the manager if it doesn't exist
+ if state_guard.is_none() {
+ *state_guard = Some(SidecarManager::new());
+ }
+ let manager = state_guard.as_mut().unwrap();
if server_running.await.unwrap_or(false) {
return;
}
diff --git a/screenpipe-app-tauri/src-tauri/src/sidecar.rs b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
index 5725be283..d8e861a78 100644
--- a/screenpipe-app-tauri/src-tauri/src/sidecar.rs
+++ b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
@@ -585,7 +585,13 @@ impl SidecarManager {
pub async fn spawn(&mut self, app: &tauri::AppHandle, override_args: Option<Vec<String>>) -> Result<(), String> {
info!("Spawning sidecar with override args: {:?}", override_args);
-
+
+ // Check if sidecar is already running
+ if self.child.is_some() {
+ info!("Sidecar already running, skipping spawn");
+ return Ok(());
+ }
+
// Update settings from store first to get audio settings
self.update_settings(app).await?;