From 271534e115e5915231c99df287bbfe396185924d Mon Sep 17 00:00:00 2001 From: Horu <73709188+HigherOrderLogic@users.noreply.github.com> Date: Sun, 17 Aug 2025 16:28:24 +1000 Subject: Add ConfigLoaded event to IPC, option to disable built-in notification (#1829) * feat: config reload ipc event * cleanups * Rename and move the new config option * rename to ConfigLoaded and emit at connection --------- Co-authored-by: Ivan Molodetskikh --- src/utils/watcher.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/utils/watcher.rs') diff --git a/src/utils/watcher.rs b/src/utils/watcher.rs index 4ed4c8ae..034e963a 100644 --- a/src/utils/watcher.rs +++ b/src/utils/watcher.rs @@ -5,7 +5,7 @@ use std::sync::mpsc; use std::time::{Duration, SystemTime}; use std::{io, thread}; -use niri_config::ConfigPath; +use niri_config::{Config, ConfigPath}; use smithay::reexports::calloop::channel::SyncSender; use crate::niri::State; @@ -137,10 +137,17 @@ pub fn setup(state: &mut State, config_path: &ConfigPath) { state .niri .event_loop - .insert_source(rx, |event, _, state| match event { - calloop::channel::Event::Msg(config) => state.reload_config(config), - calloop::channel::Event::Closed => (), - }) + .insert_source( + rx, + |event: calloop::channel::Event>, _, state| match event { + calloop::channel::Event::Msg(config) => { + let failed = config.is_err(); + state.reload_config(config); + state.ipc_config_loaded(failed); + } + calloop::channel::Event::Closed => (), + }, + ) .unwrap(); state.niri.config_file_watcher = Some(Watcher::new(config_path.clone(), process, tx)); -- cgit