From 0e6d7f0afd345e384420be9fb6c354dd559f1978 Mon Sep 17 00:00:00 2001 From: oddlama Date: Fri, 6 Oct 2023 01:13:42 +0200 Subject: [PATCH] fix: correctly check layout of container --- .../graphical/i3-per-workspace-layout/src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/users/myuser/graphical/i3-per-workspace-layout/src/main.rs b/users/myuser/graphical/i3-per-workspace-layout/src/main.rs index 4cd8c53..33c16c9 100644 --- a/users/myuser/graphical/i3-per-workspace-layout/src/main.rs +++ b/users/myuser/graphical/i3-per-workspace-layout/src/main.rs @@ -137,6 +137,11 @@ fn cmd_toggle_layout(config: &Config, workspace: &Node) -> Option { return None; } + // Don't do anything if the layout is already correct + if &con.layout == desired_layout { + return None + } + con = &con.nodes[0]; } else { // Strangely enough, setting a layout on the workspace container will create a new @@ -144,11 +149,6 @@ fn cmd_toggle_layout(config: &Config, workspace: &Node) -> Option { // we can operate on the workspace. } - // Don't do anything if the layout is already correct - if &con.layout == desired_layout { - return None - } - let desired_layout = match desired_layout { NodeLayout::SplitH => "splith", NodeLayout::SplitV => "splitv",