From e7331df2f15e093040805e8f17743c8fd3af87df Mon Sep 17 00:00:00 2001 From: Jamie Pine Date: Thu, 25 Sep 2025 20:23:04 -0700 Subject: [PATCH] feat: Revamp Window Management and UI Components for macOS App - Updated `SpacedriveApp` to implement multiple window groups, including a main companion window, browser window, icon showcase, and inspector, each with custom title bars and shared state management. - Introduced `NativeTrafficLights` and `CustomTitleBar` components to enhance window appearance and functionality, integrating native macOS traffic lights seamlessly. - Refactored `AppDelegate` to initialize app state and manage window configurations based on development settings. - Enhanced `SharedAppState` to support dynamic window opening based on user preferences and development configurations. - Added new `BrowserView` and associated components for improved file browsing experience, including sidebar navigation and content display. - Updated `SpacedriveColors` to reflect the use of native macOS colors for traffic lights, simplifying color management across the app. --- core/src/infra/daemon/bootstrap.rs | 2 +- core/src/service/watcher/mod.rs | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/core/src/infra/daemon/bootstrap.rs b/core/src/infra/daemon/bootstrap.rs index cb0732b61..81f62d7b8 100644 --- a/core/src/infra/daemon/bootstrap.rs +++ b/core/src/infra/daemon/bootstrap.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; use std::sync::Arc; -use tracing::info; +use tracing::{info, warn}; use crate::infra::daemon::rpc::RpcServer; use crate::Core; diff --git a/core/src/service/watcher/mod.rs b/core/src/service/watcher/mod.rs index 37fefa214..73bc426f7 100644 --- a/core/src/service/watcher/mod.rs +++ b/core/src/service/watcher/mod.rs @@ -499,6 +499,7 @@ impl LocationWatcher { let metrics = self.metrics.clone(); let (tx, mut rx) = mpsc::channel(self.config.event_buffer_size); + let tx_clone = tx.clone(); // Create file system watcher let mut watcher = notify::recommended_watcher(move |res| { @@ -514,15 +515,12 @@ impl LocationWatcher { // Convert notify event to our WatcherEvent let watcher_event = WatcherEvent::from_notify_event(event); - // Use spawn_blocking to avoid blocking the notify callback - // This ensures we never drop events - we wait for buffer space - let tx_clone = tx.clone(); - tokio::spawn(async move { - if let Err(e) = tx_clone.send(watcher_event).await { - error!("Failed to send watcher event (receiver dropped): {}", e); - // This should only happen if the receiver is dropped - } - }); + // Send event directly to avoid runtime context issues + // Use try_send since we're in a sync context + if let Err(e) = tx_clone.try_send(watcher_event) { + error!("Failed to send watcher event: {}", e); + // This could happen if the channel is full or receiver is dropped + } } Err(e) => { error!("File system watcher error: {}", e);