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): use Accessory mode for chat/window-mode creation on fullscreen Spaces

Louis Beaumontfa591d6e52f3
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 10cb022ca..0fbc1b007 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -684,16 +684,10 @@ impl ShowRewindWindow {
#[cfg(target_os = "macos")]
let window = {
- // Activate BEFORE building so macOS places the window
- // on the current fullscreen Space, not the leftmost desktop.
- {
- use objc::{msg_send, sel, sel_impl};
- use tauri_nspanel::cocoa::base::id;
- unsafe {
- let ns_app: id = msg_send![objc::class!(NSApplication), sharedApplication];
- let _: () = msg_send![ns_app, activateIgnoringOtherApps: true];
- }
- }
+ // Accessory mode is required for new windows to appear on
+ // fullscreen Spaces. We reset to Regular after panel setup
+ // (not on close, which caused Space-switch bugs).
+ let _ = app.set_activation_policy(tauri::ActivationPolicy::Accessory);
let app_clone = app.clone();
let builder = self.window_builder_with_label(app, "/", main_label_for_mode("window"))
.title("screenpipe")
@@ -769,6 +763,15 @@ impl ShowRewindWindow {
}
}
+ // Reset to Regular now that the panel is set up on the
+ // correct Space. Delayed slightly so the panel setup
+ // completes first (run_on_main_thread_safe is async).
+ let app_for_reset = app.clone();
+ std::thread::spawn(move || {
+ std::thread::sleep(std::time::Duration::from_millis(500));
+ let _ = app_for_reset.set_activation_policy(tauri::ActivationPolicy::Regular);
+ });
+
// Auto-hide on focus loss (debounced to survive workspace swipe animations)
let app_clone = app.clone();
let focus_cancel = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false));
@@ -1138,16 +1141,8 @@ impl ShowRewindWindow {
ShowRewindWindow::Chat => {
#[cfg(target_os = "macos")]
let window = {
- // Activate BEFORE building so macOS places the window
- // on the current fullscreen Space.
- {
- use objc::{msg_send, sel, sel_impl};
- use tauri_nspanel::cocoa::base::id;
- unsafe {
- let ns_app: id = msg_send![objc::class!(NSApplication), sharedApplication];
- let _: () = msg_send![ns_app, activateIgnoringOtherApps: true];
- }
- }
+ // Accessory mode required for new windows on fullscreen Spaces.
+ let _ = app.set_activation_policy(tauri::ActivationPolicy::Accessory);
let builder = self.window_builder(app, "/chat")
.inner_size(500.0, 650.0)
.min_inner_size(400.0, 500.0)
@@ -1199,6 +1194,13 @@ impl ShowRewindWindow {
});
}
+ // Reset to Regular after panel is set up on the correct Space.
+ let app_for_reset = app.clone();
+ std::thread::spawn(move || {
+ std::thread::sleep(std::time::Duration::from_millis(500));
+ let _ = app_for_reset.set_activation_policy(tauri::ActivationPolicy::Regular);
+ });
+
window
};