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: window mode space-switch animation and double-press issue

Louis Beaumontd91d232dc325
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index 7f1aacc8b..2dbab77bc 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -40,18 +40,34 @@ pub fn set_tray_health_icon(app_handle: tauri::AppHandle) {
pub fn show_main_window(app_handle: &tauri::AppHandle, _overlay: bool) {
info!("show_main_window called, attempting to show Main window");
- // Close Settings window if open to avoid confusion (Main overlay is transparent
- // and Settings would show through, making it look like Settings is being toggled)
- let _ = ShowRewindWindow::Settings { page: None }.close(app_handle);
+ let overlay_mode = crate::store::SettingsStore::get(app_handle)
+ .unwrap_or_default()
+ .unwrap_or_default()
+ .overlay_mode;
+ let is_window_mode = overlay_mode == "window";
+
+ // In overlay mode, close Settings (transparent overlay would show Settings through)
+ // In window mode, no need — it's an opaque window
+ if !is_window_mode {
+ let _ = ShowRewindWindow::Settings { page: None }.close(app_handle);
+ }
match ShowRewindWindow::Main.show(app_handle) {
Ok(window) => {
info!("ShowRewindWindow::Main.show succeeded, window label: {}", window.label());
- // Don't call set_focus() on macOS as it causes space switching
- // The panel's order_front_regardless() already handles visibility
- #[cfg(not(target_os = "macos"))]
- if let Err(e) = window.set_focus() {
- error!("Failed to set focus on main window: {}", e);
+
+ if is_window_mode {
+ // Window mode: focus the window on all platforms including macOS
+ if let Err(e) = window.set_focus() {
+ error!("Failed to set focus on main window: {}", e);
+ }
+ } else {
+ // Overlay mode: Don't call set_focus() on macOS as it causes space switching
+ // The panel's order_front_regardless() already handles visibility
+ #[cfg(not(target_os = "macos"))]
+ if let Err(e) = window.set_focus() {
+ error!("Failed to set focus on main window: {}", e);
+ }
}
// Register window-specific shortcuts (Escape, Ctrl+Cmd+K) on a separate task
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 a9b3b3135..e4c55e429 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -319,11 +319,36 @@ impl ShowRewindWindow {
.overlay_mode;
if overlay_mode == "window" {
- // Window mode: just show and focus the normal window
+ // Window mode: show and focus the normal window
info!("showing main window (window mode)");
window.show().ok();
- window.set_focus().ok();
- let _ = app.emit("window-focused", true);
+
+ #[cfg(target_os = "macos")]
+ {
+ // Activate the app and bring window to front on the current space
+ use objc::{msg_send, sel, sel_impl};
+ use tauri_nspanel::cocoa::base::{id, nil};
+ let app_clone = app.clone();
+ let _ = app.run_on_main_thread(move || {
+ unsafe {
+ let ns_app: id = msg_send![objc::class!(NSApplication), sharedApplication];
+ // activateIgnoringOtherApps brings our app to front
+ let _: () = msg_send![ns_app, activateIgnoringOtherApps: true];
+ }
+ // Also use Tauri's set_focus for good measure
+ if let Some(w) = RewindWindowId::Main.get(&app_clone) {
+ w.set_focus().ok();
+ }
+ let _ = app_clone.emit("window-focused", true);
+ });
+ }
+
+ #[cfg(not(target_os = "macos"))]
+ {
+ window.set_focus().ok();
+ let _ = app.emit("window-focused", true);
+ }
+
return Ok(window);
}
@@ -494,6 +519,8 @@ impl ShowRewindWindow {
if use_window_mode {
// ============================================================
// Window mode: normal resizable window with title bar
+ // Visible on all workspaces so it appears on the current space
+ // without triggering macOS space-switch animations.
// ============================================================
let builder = self.window_builder(app, "/")
.title("screenpipe")
@@ -502,9 +529,12 @@ impl ShowRewindWindow {
.decorations(true)
.visible(true)
.focused(true)
- .transparent(false);
+ .transparent(false)
+ .visible_on_all_workspaces(true);
#[cfg(target_os = "macos")]
- let builder = builder.hidden_title(false);
+ let builder = builder
+ .hidden_title(false)
+ .title_bar_style(tauri::TitleBarStyle::Visible);
let window = builder.build()?;
// Emit window-focused so timeline data loads