improv(input-sources): gracefully exit if keyboard layouts data could not be obtained

This commit is contained in:
Michael Aaron Murphy 2024-05-06 15:19:40 +02:00 committed by Michael Murphy
parent 33cb23f04f
commit b9308af4b7
3 changed files with 18 additions and 5 deletions

View file

@ -38,12 +38,13 @@ pub enum Message {
SetActiveLayout(ActiveLayout),
KeyboardSettings,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
pub struct Flags {
pub config_handler: Option<cosmic_config::Config>,
pub config: Config,
pub comp_config: CosmicCompConfig,
pub comp_config_handler: Option<cosmic_config::Config>,
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<cosmic::app::Message<Self::Message>>) {
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,