diff --git a/cosmic-applet-input-sources/src/lib.rs b/cosmic-applet-input-sources/src/lib.rs index f7c81f47..ca0f5509 100644 --- a/cosmic-applet-input-sources/src/lib.rs +++ b/cosmic-applet-input-sources/src/lib.rs @@ -9,6 +9,15 @@ mod localize; mod window; pub fn run() -> cosmic::iced::Result { localize::localize(); + + let layouts = match xkb_data::keyboard_layouts() { + Ok(layouts) => layouts, + Err(why) => { + tracing::error!("could not get keyboard layouts data: {:?}", why); + return Ok(()); + } + }; + let (config_handler, config) = match cosmic_config::Config::new(window::ID, CONFIG_VERSION) { Ok(config_handler) => { let config = match Config::get_entry(&config_handler) { @@ -46,8 +55,9 @@ pub fn run() -> cosmic::iced::Result { let flags = Flags { comp_config, comp_config_handler, - config_handler: config_handler, - config: config, + config_handler, + config, + layouts, }; cosmic::applet::run::(true, flags) } diff --git a/cosmic-applet-input-sources/src/main.rs b/cosmic-applet-input-sources/src/main.rs index 860fa906..24197a9e 100644 --- a/cosmic-applet-input-sources/src/main.rs +++ b/cosmic-applet-input-sources/src/main.rs @@ -1,3 +1,6 @@ fn main() -> cosmic::iced::Result { + tracing_subscriber::fmt::init(); + let _ = tracing_log::LogTracer::init(); + cosmic_applet_input_sources::run() } diff --git a/cosmic-applet-input-sources/src/window.rs b/cosmic-applet-input-sources/src/window.rs index 71bc989e..027c1565 100644 --- a/cosmic-applet-input-sources/src/window.rs +++ b/cosmic-applet-input-sources/src/window.rs @@ -38,12 +38,13 @@ pub enum Message { SetActiveLayout(ActiveLayout), KeyboardSettings, } -#[derive(Clone, Debug)] +#[derive(Debug)] pub struct Flags { pub config_handler: Option, pub config: Config, pub comp_config: CosmicCompConfig, pub comp_config_handler: Option, + pub layouts: KeyboardLayouts, } impl cosmic::Application for Window { type Executor = cosmic::SingleThreadExecutor; @@ -64,10 +65,9 @@ impl cosmic::Application for Window { core: Core, flags: Self::Flags, ) -> (Self, Command>) { - let layouts = xkb_data::keyboard_layouts().unwrap(); let window = Window { comp_config_handler: flags.comp_config_handler, - layouts, + layouts: flags.layouts, core, config: flags.config, config_handler: flags.config_handler,