tony / oxwm

Setting config.path to enable hot-reload of changed config file Browse files
Scott DeJong committed 2025-12-18 parent 7fc1259 commit 506050a5811bb68b5676474da7e1d30b47cc4ec0
Showing 1 changed file with 12 additions and 9 deletions. UnifiedSplit
+12 −9 src/bin/main.rs
@@ -65,15 +65,18 @@ fn load_config(
65 65
66 let config_directory = path.parent(); 66 let config_directory = path.parent();
67 67
68 - match oxwm::config::parse_lua_config(&config_string, config_directory) { 68 + let (mut config, had_broken_config) =
69 - Ok(config) => Ok((config, false)), 69 + match oxwm::config::parse_lua_config(&config_string, config_directory) {
70 - Err(_error) => { 70 + Ok(config) => (config, false),
71 - let config = oxwm::config::parse_lua_config(TEMPLATE, None).map_err(|error| { 71 + Err(_error) => {
72 - format!("Error: Failed to parse default template config:\n{}", error) 72 + let config = oxwm::config::parse_lua_config(TEMPLATE, None).map_err(|error| {
73 - })?; 73 + format!("Error: Failed to parse default template config:\n{}", error)
74 - Ok((config, true)) 74 + })?;
75 - } 75 + (config, true)
76 - } 76 + }
77 + };
78 + config.path = Some(path);
79 + Ok((config, had_broken_config))
77 } 80 }
78 81
79 fn init_config() -> Result<(), Box<dyn std::error::Error>> { 82 fn init_config() -> Result<(), Box<dyn std::error::Error>> {