fix: Run hot-reloading only on modify events
This commit is contained in:
parent
77055b80e7
commit
17750289a5
2 changed files with 8 additions and 4 deletions
|
@ -174,7 +174,7 @@ impl App {
|
|||
sender.send_success(output)?
|
||||
}
|
||||
DaemonCommand::PrintDebug(sender) => {
|
||||
let output = format!("state: {:#?}\n\nconfig: {:#?}", &self.eww_state, &self.eww_config);
|
||||
let output = format!("{:#?}", &self);
|
||||
sender.send_success(output)?
|
||||
}
|
||||
}
|
||||
|
@ -268,6 +268,9 @@ impl App {
|
|||
// refresh script-var poll stuff
|
||||
self.script_var_handler.stop_all();
|
||||
|
||||
|
||||
log::trace!("loading config: {:#?}", config);
|
||||
|
||||
self.eww_config = config;
|
||||
self.eww_state.clear_all_window_states();
|
||||
|
||||
|
|
|
@ -138,17 +138,18 @@ async fn run_filewatch<P: AsRef<Path>>(config_dir: P, evt_send: UnboundedSender<
|
|||
|
||||
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
let mut watcher: RecommendedWatcher = Watcher::new(move |res: notify::Result<notify::Event>| match res {
|
||||
Ok(event) => {
|
||||
let relevant_files_changed = event.paths.iter().any(|path| {
|
||||
Ok(notify::Event { kind: notify::EventKind::Modify(_), paths, .. }) => {
|
||||
let relevant_files_changed = paths.iter().any(|path| {
|
||||
let ext = path.extension().unwrap_or_default();
|
||||
ext == "yuck" || ext == "scss"
|
||||
});
|
||||
if !relevant_files_changed {
|
||||
if relevant_files_changed {
|
||||
if let Err(err) = tx.send(()) {
|
||||
log::warn!("Error forwarding file update event: {:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(_) => {}
|
||||
Err(e) => log::error!("Encountered Error While Watching Files: {}", e),
|
||||
})?;
|
||||
watcher.watch(&config_dir.as_ref(), RecursiveMode::Recursive)?;
|
||||
|
|
Loading…
Add table
Reference in a new issue