tony / oxwm

Updated window_manager and main to be in sync Browse files
Scott DeJong committed 2025-12-24 parent be0a1a3 commit be13d76808a99fdc7a5376737e8ccec3c6eb3c9b
Showing 2 changed files with 6 additions and 8 deletions. UnifiedSplit
+2 −5 src/bin/main.rs
@@ -26,11 +26,8 @@ fn main() -> Result<(), MainError> {
26 Err(e) => return Err(MainError::CouldNotStartWm(e)), 26 Err(e) => return Err(MainError::CouldNotStartWm(e)),
27 }; 27 };
28 28
29 - if let Some(error) = config_error { 29 + if let Some(warning) = config_warning {
30 - // Change show_startup_config_error to accept a ConfigError instead of 30 + window_manager.show_startup_config_error(warning);
31 - // a string slice.
32 - let error = format!("{error}");
33 - window_manager.show_startup_config_error(&error);
34 } 31 }
35 32
36 let should_restart = match window_manager.run() { 33 let should_restart = match window_manager.run() {
+4 −3 src/window_manager.rs
@@ -1,7 +1,7 @@
1 use crate::Config; 1 use crate::Config;
2 use crate::bar::Bar; 2 use crate::bar::Bar;
3 use crate::client::{Client, TagMask}; 3 use crate::client::{Client, TagMask};
4 -use crate::errors::WmError; 4 +use crate::errors::{ConfigError, WmError};
5 use crate::keyboard::{self, Arg, KeyAction, handlers}; 5 use crate::keyboard::{self, Arg, KeyAction, handlers};
6 use crate::layout::GapConfig; 6 use crate::layout::GapConfig;
7 use crate::layout::tiling::TilingLayout; 7 use crate::layout::tiling::TilingLayout;
@@ -312,17 +312,18 @@ impl WindowManager {
312 Ok(window_manager) 312 Ok(window_manager)
313 } 313 }
314 314
315 - pub fn show_startup_config_error(&mut self, error: &str) { 315 + pub fn show_startup_config_error(&mut self, error: ConfigError) {
316 let monitor = &self.monitors[self.selected_monitor]; 316 let monitor = &self.monitors[self.selected_monitor];
317 let monitor_x = monitor.screen_x as i16; 317 let monitor_x = monitor.screen_x as i16;
318 let monitor_y = monitor.screen_y as i16; 318 let monitor_y = monitor.screen_y as i16;
319 let screen_width = monitor.screen_width as u16; 319 let screen_width = monitor.screen_width as u16;
320 let screen_height = monitor.screen_height as u16; 320 let screen_height = monitor.screen_height as u16;
321 + let error = format!("{error}");
321 322
322 if let Err(e) = self.overlay.show_error( 323 if let Err(e) = self.overlay.show_error(
323 &self.connection, 324 &self.connection,
324 &self.font, 325 &self.font,
325 - error, 326 + error.as_str(),
326 monitor_x, 327 monitor_x,
327 monitor_y, 328 monitor_y,
328 screen_width, 329 screen_width,