From d537999b8c7b3fe71a3efbb6b282651c040a9d43 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Thu, 26 Sep 2024 10:41:13 +1000 Subject: [PATCH] autosplit: better skip logic --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 943a0e4..c4df825 100644 --- a/src/main.rs +++ b/src/main.rs @@ -165,12 +165,17 @@ async fn autosplit( ) -> Res<()> { if node.node_type == swayipc_async::NodeType::Con { let (width, height) = (node.window_rect.width, node.window_rect.height); - if width == 0 || height == 0 { + // we don't want to split zero-sized windows, but containers are also zero-sized + // - so only skip if size is 0 and we have no children + if (width == 0 || height == 0) && node.focus.is_empty() { return Ok(()); } if tree .find_as_ref(|n| n.focus.contains(&node.id)) - .is_some_and(|parent| parent.node_type != swayipc_async::NodeType::Workspace) + .is_some_and(|parent| { + parent.layout != swayipc_async::NodeLayout::SplitH + && parent.layout != swayipc_async::NodeLayout::SplitV + }) { return Ok(()); }