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(tray): reset onboarding state before showing, add Tauri window-focus listener
Louis Beaumontd739656150f8
diff --git a/screenpipe-app-tauri/components/rewind/search-command.tsx b/screenpipe-app-tauri/components/rewind/search-command.tsxindex 9fda2c58c..614b97c8b 100644--- a/screenpipe-app-tauri/components/rewind/search-command.tsx+++ b/screenpipe-app-tauri/components/rewind/search-command.tsx@@ -1,6 +1,7 @@"use client";import * as React from "react";+import { listen } from "@tauri-apps/api/event";import { useState } from "react";import {@@ -53,21 +54,19 @@ export function SearchCommand() {return () => document.removeEventListener("keydown", down, true);}, [open]);- // Close dialog when window loses focus to prevent stuck invisible overlay+ // Close dialog when Tauri window loses focusReact.useEffect(() => {- if (!open) return;-- // Small delay to prevent closing immediately on open- const timeoutId = setTimeout(() => {- const handleBlur = () => {+ const unlisten = listen<boolean>("window-focused", (event) => {+ if (!event.payload && open) {setOpen(false);- };- window.addEventListener("blur", handleBlur, { once: true });- }, 100);-- return () => clearTimeout(timeoutId);+ }+ });+ return () => {+ unlisten.then((fn) => fn());+ };}, [open]);+const handleKeyDown = (e: React.KeyboardEvent) => {if (e.key === "Enter") {e.preventDefault();diff --git a/screenpipe-app-tauri/src-tauri/src/tray.rs b/screenpipe-app-tauri/src-tauri/src/tray.rsindex 647165ce8..d4c91f708 100644--- a/screenpipe-app-tauri/src-tauri/src/tray.rs+++ b/screenpipe-app-tauri/src-tauri/src/tray.rs@@ -1,6 +1,6 @@use crate::commands::show_main_window;use crate::health::{get_recording_status, RecordingStatus};-use crate::store::get_store;+use crate::store::{get_store, OnboardingStore};use crate::window_api::ShowRewindWindow;use anyhow::Result;use once_cell::sync::Lazy;@@ -130,6 +130,10 @@ fn handle_menu_event(app_handle: &AppHandle, event: tauri::menu::MenuEvent) {let _ = ShowRewindWindow::Settings { page: None }.show(app_handle);}"onboarding" => {+ // Reset onboarding state so it shows even if previously completed+ let _ = OnboardingStore::update(app_handle, |onboarding| {+ onboarding.reset();+ });let _ = ShowRewindWindow::Onboarding.show(app_handle);}"quit" => {