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(macos): chat + shortcut reminder visible on fullscreen Spaces

Louis Beaumontc39cf2f6ce15
diff --git a/TESTING.md b/TESTING.md
index 9e2bac67c..2169fe48b 100644
--- a/TESTING.md
+++ b/TESTING.md
@@ -11,7 +11,7 @@ these break CONSTANTLY. any change to `window_api.rs`, `main.rs` shortcuts, acti
commits that broke this area: `0752ea59`, `d89c5f14`, `4a64fd1a`, `fa591d6e`, `8706ae73`, `6d44af13`, `b6ff1bf7`, `09a18070`
- [ ] **overlay shortcut on fullscreen space** — press shortcut while a fullscreen app (e.g., Chrome fullscreen) is active. overlay MUST appear on top.
-- [ ] **chat shortcut on fullscreen space** — press chat shortcut while on a fullscreen space. chat panel MUST appear on top. ⚠️ CURRENTLY BROKEN (Accessory mode removed in `0752ea59`)
+- [ ] **chat shortcut on fullscreen space** — press chat shortcut while on a fullscreen space. chat panel MUST appear on top. Fixed: panel pre-created at startup, show uses order_front→activate order.
- [ ] **chat shortcut on normal desktop** — chat appears, receives keyboard focus, can type immediately.
- [ ] **overlay toggle on/off** — press shortcut twice. first shows, second hides. no "ghost" window left behind.
- [ ] **chat toggle on/off** — press chat shortcut twice. first shows, second closes.
@@ -248,7 +248,7 @@ run section 7 and 10.
- macOS only shows permission prompts once (NotDetermined → Denied is permanent). must use System Settings to re-grant.
- debug builds use ~3-5x more CPU than release builds for vision pipeline.
- first frame after app launch always triggers OCR (intentional — no previous frame to compare against).
-- chat panel can't appear on fullscreen spaces when created for the first time (needs Accessory mode or pre-creation at startup). workaround: pre-create panel hidden at launch.
+- chat panel is pre-created hidden at startup so it exists before user presses the shortcut. Creation no longer activates/shows — only the show_existing path does (matching main overlay pattern).
- shortcut reminder should use `CanJoinAllSpaces` (visible on all Spaces simultaneously). chat and main overlay should use `MoveToActiveSpace` (moved to current Space on show, then flag removed to pin).
## log locations
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index 3619673e8..d00aada64 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -571,6 +571,15 @@ pub async fn show_shortcut_reminder(
let app_clone = app_handle.clone();
let _ = app_handle.run_on_main_thread(move || {
if let Ok(panel) = app_clone.get_webview_panel("shortcut-reminder") {
+ use tauri_nspanel::cocoa::appkit::NSWindowCollectionBehavior;
+ // Re-set level and behaviors on every show — order_out
+ // may have cleared the Space association.
+ panel.set_level(1001);
+ panel.set_collection_behaviour(
+ NSWindowCollectionBehavior::NSWindowCollectionBehaviorCanJoinAllSpaces |
+ NSWindowCollectionBehavior::NSWindowCollectionBehaviorIgnoresCycle |
+ NSWindowCollectionBehavior::NSWindowCollectionBehaviorFullScreenAuxiliary
+ );
panel.order_front_regardless();
}
});
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 2f41b1922..d94e84b36 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1526,6 +1526,8 @@ async fn main() {
// existing panel on fullscreen Spaces. New windows created in
// Regular activation policy can't appear on fullscreen Spaces,
// but existing panels with MoveToActiveSpace + level 1001 can.
+ // The Chat creation path only configures level/behaviors — it
+ // does NOT activate or show, so no blink or focus-steal here.
if onboarding_store.is_completed {
let app_handle_chat = app.handle().clone();
tauri::async_runtime::spawn(async move {
@@ -1534,25 +1536,8 @@ async fn main() {
if app_handle_chat.get_webview_window("chat").is_none() {
info!("Pre-creating chat panel for fullscreen Space support");
match ShowRewindWindow::Chat.show(&app_handle_chat) {
- Ok(window) => {
- // Hide it immediately — shortcut will show it later
- tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
- #[cfg(target_os = "macos")]
- {
- use crate::window_api::run_on_main_thread_safe;
- use tauri_nspanel::ManagerExt as _;
- let app_clone = app_handle_chat.clone();
- run_on_main_thread_safe(&app_handle_chat, move || {
- if let Ok(panel) = app_clone.get_webview_panel("chat") {
- panel.order_out(None);
- }
- });
- }
- #[cfg(not(target_os = "macos"))]
- {
- let _ = window.hide();
- }
- info!("Chat panel pre-created and hidden");
+ Ok(_window) => {
+ info!("Chat panel pre-created (hidden, panel configured)");
}
Err(e) => {
warn!("Failed to pre-create chat panel: {}", e);
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 6d6c4c5c7..c630ef4ef 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -642,15 +642,18 @@ impl ShowRewindWindow {
NSWindowCollectionBehavior::NSWindowCollectionBehaviorMoveToActiveSpace |
NSWindowCollectionBehavior::NSWindowCollectionBehaviorFullScreenAuxiliary
);
- // Activate so the chat panel appears on the current
- // fullscreen Space and receives keyboard input.
+ // order_front FIRST, then activate — same order as
+ // show_existing_main. Activating first on a fullscreen
+ // Space causes macOS to switch Spaces before the panel
+ // appears; ordering front first places the panel on the
+ // current Space, then activation happens in-place.
+ panel.order_front_regardless();
crate::space_monitor::suppress_space_monitor(500);
unsafe {
use tauri_nspanel::cocoa::base::id;
let ns_app: id = msg_send![objc::class!(NSApplication), sharedApplication];
let _: () = msg_send![ns_app, activateIgnoringOtherApps: true];
}
- panel.order_front_regardless();
panel.make_key_window();
// Remove MoveToActiveSpace now that the panel is shown.
// Keeps it pinned to THIS Space so it won't follow
@@ -1215,7 +1218,12 @@ impl ShowRewindWindow {
.hidden_title(true);
let window = builder.build()?;
- // Convert to panel for fullscreen support
+ // Convert to panel for fullscreen support.
+ // Only configure level + behaviors here — do NOT activate
+ // or show. The show_existing path handles that when the
+ // user presses the shortcut. This matches the main overlay
+ // creation pattern and avoids focus-stealing on startup
+ // when the panel is pre-created hidden.
if let Ok(_panel) = window.to_panel() {
info!("Successfully converted chat window to panel");
@@ -1239,27 +1247,11 @@ impl ShowRewindWindow {
let sharing: u64 = if capturable { 1 } else { 0 };
let _: () = unsafe { msg_send![&*panel, setSharingType: sharing] };
+ // MoveToActiveSpace so show_existing can pull
+ // it to any Space (including fullscreen).
panel.set_collection_behaviour(
NSWindowCollectionBehavior::NSWindowCollectionBehaviorMoveToActiveSpace |
- NSWindowCollectionBehavior::NSWindowCollectionBehaviorFullScreenAuxiliary
- );
-
- // Activate THEN show — same pattern as the fullscreen
- // overlay's show_existing_main. This places the panel
- // on the current fullscreen Space without Accessory mode.
- crate::space_monitor::suppress_space_monitor(500);
- unsafe {
- use tauri_nspanel::cocoa::base::id;
- let ns_app: id = msg_send![objc::class!(NSApplication), sharedApplication];
- let _: () = msg_send![ns_app, activateIgnoringOtherApps: true];
- }
- panel.order_front_regardless();
- panel.make_key_window();
-
- // Remove MoveToActiveSpace now that the panel is shown.
- // Keeps it pinned to THIS Space so it won't follow
- // three-finger swipes (same pattern as main overlay).
- panel.set_collection_behaviour(
+ NSWindowCollectionBehavior::NSWindowCollectionBehaviorIgnoresCycle |
NSWindowCollectionBehavior::NSWindowCollectionBehaviorFullScreenAuxiliary
);
}