diff options
| author | Horu <73709188+HigherOrderLogic@users.noreply.github.com> | 2025-08-17 16:28:24 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-17 09:28:24 +0300 |
| commit | 271534e115e5915231c99df287bbfe396185924d (patch) | |
| tree | 5642ba961a88d5f5d1f5afc0686d7b2f2476f28c /src/utils/watcher.rs | |
| parent | af30cc8df68b29973c8b9eec290f9e6b93463929 (diff) | |
| download | niri-271534e115e5915231c99df287bbfe396185924d.tar.gz niri-271534e115e5915231c99df287bbfe396185924d.tar.bz2 niri-271534e115e5915231c99df287bbfe396185924d.zip | |
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 <yalterz@gmail.com>
Diffstat (limited to 'src/utils/watcher.rs')
| -rw-r--r-- | src/utils/watcher.rs | 17 |
1 files changed, 12 insertions, 5 deletions
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<Result<Config, ()>>, _, 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)); |
