feat(wm): add config option to set tiling

This commit adds the option to set whether a workspace should be tiled or not by default. It retains
the default behaviour of komorebi, but adds the option to set a workspace to not be tiled by
default, but still be able to change the default layout for that workspace.
This commit is contained in:
omark96
2025-08-01 19:27:14 +02:00
committed by Jeezy
parent b4e16e43e9
commit f40fb9a251
2 changed files with 9 additions and 5 deletions
+6
View File
@@ -233,6 +233,9 @@ pub struct WorkspaceConfig {
/// Enable or disable float override, which makes it so every new window opens in floating mode (default: false) /// Enable or disable float override, which makes it so every new window opens in floating mode (default: false)
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub float_override: Option<bool>, pub float_override: Option<bool>,
/// Enable or disable tiling for the workspace (default: true)
#[serde(skip_serializing_if = "Option::is_none")]
pub tile: Option<bool>,
/// Specify an axis on which to flip the selected layout (default: None) /// Specify an axis on which to flip the selected layout (default: None)
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub layout_flip: Option<Axis>, pub layout_flip: Option<Axis>,
@@ -281,6 +284,8 @@ impl From<&Workspace> for WorkspaceConfig {
} }
}); });
let tile = if *value.tile() { None } else { Some(false) };
Self { Self {
name: value name: value
.name() .name()
@@ -318,6 +323,7 @@ impl From<&Workspace> for WorkspaceConfig {
window_container_behaviour: *value.window_container_behaviour(), window_container_behaviour: *value.window_container_behaviour(),
window_container_behaviour_rules: Option::from(window_container_behaviour_rules), window_container_behaviour_rules: Option::from(window_container_behaviour_rules),
float_override: *value.float_override(), float_override: *value.float_override(),
tile,
layout_flip: value.layout_flip(), layout_flip: value.layout_flip(),
floating_layer_behaviour: value.floating_layer_behaviour(), floating_layer_behaviour: value.floating_layer_behaviour(),
wallpaper: None, wallpaper: None,
+3 -5
View File
@@ -208,18 +208,16 @@ impl Workspace {
if let Some(layout) = &config.layout { if let Some(layout) = &config.layout {
self.layout = Layout::Default(*layout); self.layout = Layout::Default(*layout);
self.tile = true;
} }
if let Some(pathbuf) = &config.custom_layout { if let Some(pathbuf) = &config.custom_layout {
let layout = CustomLayout::from_path(pathbuf)?; let layout = CustomLayout::from_path(pathbuf)?;
self.layout = Layout::Custom(layout); self.layout = Layout::Custom(layout);
self.tile = true;
} }
if config.custom_layout.is_none() && config.layout.is_none() { self.tile =
self.tile = false; !(config.custom_layout.is_none() && config.layout.is_none() && config.tile.is_none()
} || config.tile.is_some_and(|tile| !tile));
let mut all_layout_rules = vec![]; let mut all_layout_rules = vec![];
if let Some(layout_rules) = &config.layout_rules { if let Some(layout_rules) = &config.layout_rules {