diff --git a/src/shell/layout/mod.rs b/src/shell/layout/mod.rs index 5bfc6c1e..ed97a62a 100644 --- a/src/shell/layout/mod.rs +++ b/src/shell/layout/mod.rs @@ -55,14 +55,14 @@ pub fn is_dialog(window: &CosmicSurface) -> bool { false } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub struct TilingExceptions { app_ids: RegexSet, titles: RegexSet, } impl TilingExceptions { - pub fn new(config: &Config) -> Self { + pub fn new(config: &Config) -> Result { let mut app_ids = Vec::new(); let mut titles = Vec::new(); @@ -73,10 +73,10 @@ impl TilingExceptions { } } - Self { - app_ids: RegexSet::new(app_ids).unwrap(), - titles: RegexSet::new(titles).unwrap(), - } + Ok(Self { + app_ids: RegexSet::new(app_ids)?, + titles: RegexSet::new(titles)?, + }) } } diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 122cbe92..1b4c8b09 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -7,6 +7,7 @@ use std::{ sync::atomic::Ordering, time::{Duration, Instant}, }; +use tracing::error; use wayland_backend::server::ClientId; use crate::wayland::protocols::workspace::WorkspaceCapabilities; @@ -1235,6 +1236,11 @@ impl Shell { pub fn new(config: &Config) -> Self { let theme = cosmic::theme::system_preference(); + let tiling_exceptions = layout::TilingExceptions::new(config).unwrap_or_else(|e| { + error!(?e, "Could not load tiling exceptions, using default"); + layout::TilingExceptions::default() + }); + Shell { workspaces: Workspaces::new(config, theme.clone()), seats: Seats::new(), @@ -1252,7 +1258,7 @@ impl Shell { resize_mode: ResizeMode::None, resize_state: None, resize_indicator: None, - tiling_exceptions: layout::TilingExceptions::new(config), + tiling_exceptions, #[cfg(feature = "debug")] debug_active: false,