pub fn new(config: &impl Config) -> Self {
        let mut available_layouts: Vec<Layout> = Vec::new();

        tracing::trace!("Looking for layouts named: {:?}", config.layouts());
        for name in config.layouts() {
            if let Some(def) = config
                .layout_definitions()
                .iter()
                .find(|def| def.name == name)
            {
                available_layouts.push(def.clone());
            } else {
                tracing::warn!("There is no Layout with the name {:?}", name);
            }
        }

        let mut available_layouts_per_ws: HashMap<usize, Vec<Layout>> = HashMap::new();

        for (i, ws) in config.workspaces().unwrap_or_default().iter().enumerate() {
            if let Some(ws_layout_names) = &ws.layouts {
                let wsid = i + 1;
                for ws_layout_name in ws_layout_names {
                    if let Some(layout) = config
                        .layout_definitions()
                        .iter()
                        .find(|layout| layout.name == *ws_layout_name)
                    {
                        available_layouts_per_ws
                            .entry(wsid)
                            .and_modify(|layouts| layouts.push(layout.clone()))
                            .or_insert_with(|| vec![layout.clone()]);
                    } else {
                        tracing::warn!("There is no Layout with the name {:?}, but was configured on workspace {:?}", ws_layout_name, wsid);
                    }
                }
            }
            if let Some(default_layout) = &ws.default_layout {
                let wsid = i + 1;
                if let Some(layout) = config
                    .layout_definitions()
                    .iter()
                    .find(|layout| layout.name == *default_layout)
                {
                    // add the default layout to the available layouts if it's not already there
                    available_layouts_per_ws
                        .entry(wsid)
                        .and_modify(|layouts| {
                            if !layouts.iter().any(|l| l.name == layout.name) {
                                layouts.push(layout.clone());
                            }
                        })
                        .or_insert_with(|| vec![layout.clone()]);
                } else {
                    tracing::warn!("There is no Layout with the name {:?}, but was configured as default on workspace {:?}", default_layout, wsid);
                }
            }
        }

        if available_layouts.is_empty() {
            tracing::warn!(
                "No Layouts were loaded from config - defaulting to a single default Layout"
            );
            available_layouts.push(Layout::default());
        }

        tracing::trace!("The general available layouts are: {:?}", available_layouts);
        tracing::trace!(
            "The workspace specific available layouts are: {:?}",
            available_layouts_per_ws
        );

        let mut layout_manager = Self {
            mode: config.layout_mode(),
            available_layouts,
            available_layouts_per_ws,
            layouts: HashMap::new(),
        };

        // set the current layout to the default layout for workspaces that have one configured
        for (i, ws) in config.workspaces().unwrap_or_default().iter().enumerate() {
            if let Some(default_layout) = &ws.default_layout {
                let wsid = i + 1;
                layout_manager.set_layout(wsid, wsid, default_layout);
            }
        }

        layout_manager
    }
Create a new [`LayoutManager`] from the config
leftwm-core/src/layouts/layout_manager.rs