From 52c579d5567d0b16ae68177fad05c612baba38af Mon Sep 17 00:00:00 2001 From: sodiboo <37938646+sodiboo@users.noreply.github.com> Date: Tue, 5 Aug 2025 15:27:28 +0200 Subject: fix hot reloading `/etc/niri/config.kdl` (#1907) * refactor config load logic, and properly watch the system config path * move config creation to niri-config, and make the errors a bit nicer notably, "error creating config" is now a cause for "error loading config", instead of it being one error and then "error loading config: no such file or directory". also, failure to load a config is now printed as an error level diagnostic (because it is indeed an error, not just a warning you can shrug off) * refactor watcher tests; add some new ones now they check for the file contents too! and i added some tests for ConfigPath::Regular, including a messy one with many symlink swaps * fixes --------- Co-authored-by: Ivan Molodetskikh --- src/ui/config_error_notification.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/config_error_notification.rs b/src/ui/config_error_notification.rs index 9b414f00..4e976633 100644 --- a/src/ui/config_error_notification.rs +++ b/src/ui/config_error_notification.rs @@ -68,10 +68,9 @@ impl ConfigErrorNotification { ) } - pub fn show_created(&mut self, created_path: PathBuf) { - let created_path = Some(created_path); - if self.created_path != created_path { - self.created_path = created_path; + pub fn show_created(&mut self, created_path: &Path) { + if self.created_path.as_deref() != Some(created_path) { + self.created_path = Some(created_path.to_owned()); self.buffers.borrow_mut().clear(); } -- cgit