From 4f7a8f10c01d95ccd542ab1fda5222a00854938f Mon Sep 17 00:00:00 2001 From: alex-ds13 <145657253+alex-ds13@users.noreply.github.com> Date: Thu, 16 Jan 2025 18:15:48 +0000 Subject: [PATCH] fix(wm): properly store tile state when caching ws Previously, when caching a workspace config for a monitor it would simply store the `DefaultLayout` on `layout` even if the original workspace config had the `layout` as `None`, which makes komorebi create a workspace with the `layout` as default `BSP` and the `tile` set to `false`. This resulted in floating workspaces would becoming tiling `BSP` workspaces after a monitor disconnect and reconnect. This commit fixes this by turning the `layout` to `None` when `tile` is `false`. --- komorebi/src/static_config.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/komorebi/src/static_config.rs b/komorebi/src/static_config.rs index 90da6b3e..da5c2c58 100644 --- a/komorebi/src/static_config.rs +++ b/komorebi/src/static_config.rs @@ -206,12 +206,14 @@ impl From<&Workspace> for WorkspaceConfig { .name() .clone() .unwrap_or_else(|| String::from("unnamed")), - layout: match value.layout() { - Layout::Default(layout) => Option::from(*layout), - // TODO: figure out how we might resolve file references in the future - Layout::Custom(_) => None, - }, custom_layout: None, + layout: value + .tile() + .then_some(match value.layout() { + Layout::Default(layout) => Option::from(*layout), + Layout::Custom(_) => None, + }) + .flatten(), layout_rules: Option::from(layout_rules), // TODO: figure out how we might resolve file references in the future custom_layout_rules: None,