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(windows): use Settings window instead of overlay, fix shortcut toggle

Louis Beaumontc13e21b55d8e
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index aabc84cf1..869e9f99c 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -80,7 +80,12 @@ pub fn set_tray_health_icon(app_handle: tauri::AppHandle) {
#[specta::specta]
pub fn show_main_window(app_handle: &tauri::AppHandle, _overlay: bool) {
info!("show_main_window called");
+ // macOS: show the overlay panel (NSPanel) on top of fullscreen apps
+ // Windows: show the settings/home window (embedded timeline, normal window)
+ #[cfg(target_os = "macos")]
let window_to_show = ShowRewindWindow::Main;
+ #[cfg(not(target_os = "macos"))]
+ let window_to_show = ShowRewindWindow::Settings { page: None };
match window_to_show.show(app_handle) {
Ok(window) => {
@@ -119,7 +124,10 @@ pub fn hide_main_window(app_handle: &tauri::AppHandle) {
// handler in window_api.rs. Do NOT also unregister them here — doing
// so races with the focus handler and causes duplicate unregister calls.
+ #[cfg(target_os = "macos")]
let window_to_close = ShowRewindWindow::Main;
+ #[cfg(not(target_os = "macos"))]
+ let window_to_close = ShowRewindWindow::Settings { page: None };
if let Err(e) = window_to_close.close(app_handle) {
error!("failed to close window: {}", e);
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 3e34252b2..2a2ba5aa2 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -437,35 +437,31 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),
}
#[cfg(not(target_os = "macos"))]
{
- use crate::store::SettingsStore;
- use crate::window_api::main_label_for_mode;
- let mode = SettingsStore::get(app)
- .unwrap_or_default()
- .unwrap_or_default()
- .overlay_mode;
- let label = main_label_for_mode(&mode);
-
- // Debug: list all existing windows
- for (wlabel, _) in app.webview_windows() {
- info!("existing window: {}", wlabel);
- }
+ // Windows uses the Settings window (embedded timeline) as main UI.
+ // Check "settings" label directly instead of overlay labels.
+ let label = "settings";
if let Some(window) = app.get_webview_window(label) {
info!("found {} window, checking visibility", label);
+ // On Windows, close() minimizes the window, but is_visible()
+ // still returns true for minimized windows. Check is_minimized()
+ // to correctly detect "hidden" state.
+ let is_minimized = window.is_minimized().unwrap_or(false);
match window.is_visible() {
- Ok(true) => {
- info!("{} window is visible, hiding it", label);
+ Ok(true) if !is_minimized => {
+ info!("{} window is visible (not minimized), hiding it", label);
hide_main_window(app)
}
+ Ok(true) if is_minimized => {
+ info!("{} window is minimized, restoring it", label);
+ show_main_window(app, false)
+ }
Ok(false) => {
info!("{} window exists but not visible, showing it", label);
show_main_window(app, false)
}
- Err(e) => {
- info!(
- "error checking visibility: {}, showing main window anyway",
- e
- );
+ _ => {
+ info!("showing main window");
show_main_window(app, false)
}
}
@@ -597,15 +593,13 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),
}
#[cfg(not(target_os = "macos"))]
{
- use crate::store::SettingsStore;
- use crate::window_api::main_label_for_mode;
- let mode = SettingsStore::get(app)
- .unwrap_or_default()
- .unwrap_or_default()
- .overlay_mode;
- let label = main_label_for_mode(&mode);
+ // Windows uses "settings" window (embedded timeline)
+ let label = "settings";
if let Some(window) = app.get_webview_window(label) {
- if !window.is_visible().unwrap_or(false) {
+ // On Windows, minimized windows still report is_visible()=true
+ let needs_show = !window.is_visible().unwrap_or(false)
+ || window.is_minimized().unwrap_or(false);
+ if needs_show {
show_main_window(app, false);
}
} else {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
index 6d578ce9b..9c0bbe877 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -1134,6 +1134,10 @@ impl ShowRewindWindow {
}
#[cfg(not(target_os = "macos"))]
{
+ // On Windows, restore from minimized state before focusing
+ if window.is_minimized().unwrap_or(false) {
+ window.unminimize().ok();
+ }
window.set_focus().ok();
}
@@ -2076,6 +2080,13 @@ impl ShowRewindWindow {
// }
if let Some(window) = id.get(app) {
+ // On Windows, minimize the Settings window instead of closing it
+ // so it stays in the taskbar and can be restored quickly.
+ #[cfg(target_os = "windows")]
+ if id.label() == RewindWindowId::Settings.label() {
+ window.minimize().ok();
+ return Ok(());
+ }
window.close().ok();
}
Ok(())