| @@ -29,12 +29,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 29 |
_ => {} |
29 |
_ => {} |
| 30 |
} |
30 |
} |
| 31 |
|
31 |
|
| 32 |
- let (config, had_broken_config) = load_config(custom_config_path)?; |
32 |
+ let (config, config_error) = load_config(custom_config_path)?; |
| 33 |
|
33 |
|
| 34 |
let mut window_manager = oxwm::window_manager::WindowManager::new(config)?; |
34 |
let mut window_manager = oxwm::window_manager::WindowManager::new(config)?; |
| 35 |
|
35 |
|
| 36 |
- if had_broken_config { |
36 |
+ if let Some(error) = config_error { |
| 37 |
- window_manager.show_migration_overlay(); |
37 |
+ window_manager.show_startup_config_error(&error); |
| 38 |
} |
38 |
} |
| 39 |
|
39 |
|
| 40 |
let should_restart = window_manager.run()?; |
40 |
let should_restart = window_manager.run()?; |
| @@ -54,7 +54,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 54 |
|
54 |
|
| 55 |
fn load_config( |
55 |
fn load_config( |
| 56 |
custom_path: Option<PathBuf>, |
56 |
custom_path: Option<PathBuf>, |
| 57 |
-) -> Result<(oxwm::Config, bool), Box<dyn std::error::Error>> { |
57 |
+) -> Result<(oxwm::Config, Option<String>), Box<dyn std::error::Error>> { |
| 58 |
let config_path = if let Some(path) = custom_path { |
58 |
let config_path = if let Some(path) = custom_path { |
| 59 |
path |
59 |
path |
| 60 |
} else { |
60 |
} else { |
| @@ -86,21 +86,21 @@ fn load_config( |
| 86 |
|
86 |
|
| 87 |
let config_directory = config_path.parent(); |
87 |
let config_directory = config_path.parent(); |
| 88 |
|
88 |
|
| 89 |
- let (mut config, had_error) = |
89 |
+ let (mut config, config_error) = |
| 90 |
match oxwm::config::parse_lua_config(&config_string, config_directory) { |
90 |
match oxwm::config::parse_lua_config(&config_string, config_directory) { |
| 91 |
- Ok(config) => (config, false), |
91 |
+ Ok(config) => (config, None), |
| 92 |
- Err(_error) => { |
92 |
+ Err(error) => { |
| 93 |
let template = include_str!("../../templates/config.lua"); |
93 |
let template = include_str!("../../templates/config.lua"); |
| 94 |
let config = oxwm::config::parse_lua_config(template, None).map_err(|error| { |
94 |
let config = oxwm::config::parse_lua_config(template, None).map_err(|error| { |
| 95 |
format!("Failed to parse default template config: {}", error) |
95 |
format!("Failed to parse default template config: {}", error) |
| 96 |
})?; |
96 |
})?; |
| 97 |
- (config, true) |
97 |
+ (config, Some(format!("{}", error))) |
| 98 |
} |
98 |
} |
| 99 |
}; |
99 |
}; |
| 100 |
|
100 |
|
| 101 |
config.path = Some(config_path); |
101 |
config.path = Some(config_path); |
| 102 |
|
102 |
|
| 103 |
- Ok((config, had_error)) |
103 |
+ Ok((config, config_error)) |
| 104 |
} |
104 |
} |
| 105 |
|
105 |
|
| 106 |
fn init_config() -> Result<(), Box<dyn std::error::Error>> { |
106 |
fn init_config() -> Result<(), Box<dyn std::error::Error>> { |