first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ license.workspace = true
[dependencies]
async-channel.workspace = true
galaxyui.workspace = true
galaxyui_core.workspace = true
log.workspace = true
anyhow.workspace = true
notify-debouncer-full.workspace = true
+4 -2
View File
@@ -1,8 +1,9 @@
use galaxyui::{Entity, ModelContext, ModelHandle, SingletonEntity};
use notify_debouncer_full::notify::{RecursiveMode, WatchFilter};
use std::path::PathBuf;
use std::time::Duration;
use notify_debouncer_full::notify::{RecursiveMode, WatchFilter};
use galaxyui_core::{Entity, ModelContext, ModelHandle, SingletonEntity};
use crate::{BulkFilesystemWatcher, BulkFilesystemWatcherEvent};
/// Duration between filesystem watch events for the home directory watcher, in milliseconds.
@@ -46,6 +47,7 @@ impl HomeDirectoryWatcher {
/// Forwards filesystem events to home directory watcher subscribers.
fn handle_fs_event(
&mut self,
_: ModelHandle<BulkFilesystemWatcher>,
event: &BulkFilesystemWatcherEvent,
ctx: &mut ModelContext<Self>,
) {
+34 -27
View File
@@ -1,27 +1,23 @@
use std::{
collections::{HashMap, HashSet},
future::Future,
path::{Path, PathBuf},
sync::mpsc::{self, channel},
thread,
time::Duration,
};
use std::collections::{HashMap, HashSet};
use std::future::Future;
use std::path::{Path, PathBuf};
use std::sync::mpsc::{self, channel};
use std::thread;
use std::time::Duration;
pub mod home_watcher;
pub use home_watcher::{HomeDirectoryWatcher, HomeDirectoryWatcherEvent};
use anyhow::Result;
use futures::channel::oneshot;
use galaxyui::{Entity, ModelContext};
use notify_debouncer_full::{
new_debouncer_opt,
notify::{
self,
event::{ModifyKind, RenameMode},
EventKind, RecommendedWatcher, RecursiveMode, WatchFilter,
},
DebounceEventHandler, DebounceEventResult, DebouncedEvent, Debouncer, NoCache,
pub use home_watcher::{HomeDirectoryWatcher, HomeDirectoryWatcherEvent};
use notify_debouncer_full::notify::event::{ModifyKind, RenameMode};
use notify_debouncer_full::notify::{
self, EventKind, RecommendedWatcher, RecursiveMode, WatchFilter,
};
use notify_debouncer_full::{
new_debouncer_opt, DebounceEventHandler, DebounceEventResult, DebouncedEvent, Debouncer,
NoCache,
};
use galaxyui_core::{Entity, ModelContext};
#[derive(Debug)]
enum BackgroundFileWatcherCommand {
@@ -47,20 +43,19 @@ impl BackgroundFileWatcher {
debounce_duration: Duration,
handler: WatcherEventHandler,
rx: mpsc::Receiver<BackgroundFileWatcherCommand>,
) -> Self {
) -> Result<Self> {
let debounced_watcher = new_debouncer_opt(
debounce_duration,
None,
handler,
NoCache,
notify::Config::default(),
)
.expect("Should be able to create watcher");
)?;
Self {
Ok(Self {
notifier: debounced_watcher,
rx,
}
})
}
/// Listen to streamed in commands to modify the internal notifier state.
@@ -150,12 +145,24 @@ impl BulkFilesystemWatcher {
if let Err(e) = thread::Builder::new()
.name("Bulk Filesystem Watcher".into())
.spawn(move || {
let watcher = BackgroundFileWatcher::new(
match BackgroundFileWatcher::new(
debounce_duration,
WatcherEventHandler { tx },
bg_rx,
);
watcher.run();
) {
Ok(watcher) => watcher.run(),
Err(e) => {
// The thread exits, which drops `bg_rx` and the
// event-channel sender. Subsequent `register_path` /
// `unregister_path` calls will get `SendError` and
// log a warning — the app continues without file
// watching.
log::error!(
"Failed to create filesystem watcher, \
file watching will be disabled: {e:?}"
);
}
}
})
{
log::error!("Failed to spawn thread for background file watcher {e:?}");