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
fix: suspend global shortcuts during shortcut recording
Louis Beaumont700620a2db61
diff --git a/screenpipe-app-tauri/components/settings/shortcut-row.tsx b/screenpipe-app-tauri/components/settings/shortcut-row.tsxindex 822e3ff72..d4881ad5f 100644--- a/screenpipe-app-tauri/components/settings/shortcut-row.tsx+++ b/screenpipe-app-tauri/components/settings/shortcut-row.tsx@@ -36,6 +36,11 @@ const ShortcutRow = ({useEffect(() => {if (!isRecording) return;+ // Suspend global shortcuts while recording to prevent them from triggering+ commands.suspendGlobalShortcuts().catch((e) => {+ console.error("failed to suspend shortcuts:", e);+ });+const handleKeyDown = (event: KeyboardEvent) => {event.preventDefault();@@ -81,6 +86,10 @@ const ShortcutRow = ({target.tagName === "TEXTAREA");};+ // Resume global shortcuts after recording ends+ commands.resumeGlobalShortcuts().catch((e) => {+ console.error("failed to resume shortcuts:", e);+ });};}, [isRecording]);diff --git a/screenpipe-app-tauri/lib/utils/tauri.ts b/screenpipe-app-tauri/lib/utils/tauri.tsindex 0970b1961..3ec765be3 100644--- a/screenpipe-app-tauri/lib/utils/tauri.ts+++ b/screenpipe-app-tauri/lib/utils/tauri.ts@@ -249,6 +249,30 @@ async setTrayUnhealthIcon() : Promise<void> {},async setTrayHealthIcon() : Promise<void> {await TAURI_INVOKE("set_tray_health_icon");+},+/**+ * Suspend all global shortcuts (for shortcut recording mode)+ * Call this before entering shortcut recording to prevent existing shortcuts from triggering+ */+async suspendGlobalShortcuts() : Promise<Result<null, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("suspend_global_shortcuts") };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}+},+/**+ * Resume all global shortcuts (after shortcut recording mode)+ * Call this after exiting shortcut recording to re-register all shortcuts+ */+async resumeGlobalShortcuts() : Promise<Result<null, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("resume_global_shortcuts") };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}}}diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rsindex 1e2492780..26bf8e1c1 100755--- a/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/screenpipe-app-tauri/src-tauri/src/main.rs@@ -313,6 +313,25 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),Ok(())}+#[tauri::command]+#[specta::specta]+async fn suspend_global_shortcuts(app: AppHandle) -> Result<(), String> {+ let global_shortcut = app.global_shortcut();+ global_shortcut+ .unregister_all()+ .map_err(|e| format!("failed to suspend shortcuts: {}", e))?;+ info!("global shortcuts suspended for recording");+ Ok(())+}++#[tauri::command]+#[specta::specta]+async fn resume_global_shortcuts(app: AppHandle) -> Result<(), String> {+ initialize_global_shortcuts(&app).await?;+ info!("global shortcuts resumed after recording");+ Ok(())+}+#[tauri::command]#[specta::specta]fn get_env(name: &str) -> String {@@ -836,6 +855,8 @@ async fn main() {get_media_file,upload_file_to_s3,update_global_shortcuts,+ suspend_global_shortcuts,+ resume_global_shortcuts,get_env]).setup(move |app| {