From 4836a39b1c03a69f9b267a7a4e03b6f42cb48764 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 15:43:59 -0700 Subject: [PATCH] refactor(mac): ToggleWorkspaceWindowContainerBehaviour calls the named method KDE has The arm was the same code inline as toggle_workspace_window_container_behaviour on KDE (the two differ only in how rustfmt wrapped the match arms). The macOS arm calls a method with that name and body. No behaviour change. Verified: fake-CC cargo clippy -p komorebi-macos ... --all-targets -D warnings: PASS (type-check only). Not run: the macOS tests (the Mac Mini). --- .../komorebi/src/process_command.rs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/komorebi-for-mac/komorebi/src/process_command.rs b/komorebi-for-mac/komorebi/src/process_command.rs index 8415a1f3..3d225663 100644 --- a/komorebi-for-mac/komorebi/src/process_command.rs +++ b/komorebi-for-mac/komorebi/src/process_command.rs @@ -113,6 +113,24 @@ impl CommandTarget for WindowManager { } impl WindowManager { + /// Switches the focused workspace between creating a container for a new window and adding it to the focused one + pub fn toggle_workspace_window_container_behaviour(&mut self) -> eyre::Result<()> { + let current_global_behaviour = self.window_management_behaviour.current_behaviour; + if let Some(behaviour) = &mut self.focused_workspace_mut()?.window_container_behaviour { + match behaviour { + WindowContainerBehaviour::Create => *behaviour = WindowContainerBehaviour::Append, + WindowContainerBehaviour::Append => *behaviour = WindowContainerBehaviour::Create, + } + } else { + self.focused_workspace_mut()?.window_container_behaviour = + Some(match current_global_behaviour { + WindowContainerBehaviour::Create => WindowContainerBehaviour::Append, + WindowContainerBehaviour::Append => WindowContainerBehaviour::Create, + }); + }; + Ok(()) + } + /// Sets the column and row ratios of the focused workspace's layout pub fn set_layout_ratios( &mut self, @@ -1008,25 +1026,7 @@ impl WindowManager { SocketMessage::Retile => self.retile_all(false)?, SocketMessage::RetileWithResizeDimensions => self.retile_all(true)?, SocketMessage::ToggleWorkspaceWindowContainerBehaviour => { - let current_global_behaviour = self.window_management_behaviour.current_behaviour; - if let Some(behaviour) = - &mut self.focused_workspace_mut()?.window_container_behaviour - { - match behaviour { - WindowContainerBehaviour::Create => { - *behaviour = WindowContainerBehaviour::Append - } - WindowContainerBehaviour::Append => { - *behaviour = WindowContainerBehaviour::Create - } - } - } else { - self.focused_workspace_mut()?.window_container_behaviour = - Some(match current_global_behaviour { - WindowContainerBehaviour::Create => WindowContainerBehaviour::Append, - WindowContainerBehaviour::Append => WindowContainerBehaviour::Create, - }); - }; + self.toggle_workspace_window_container_behaviour()? } SocketMessage::ToggleWorkspaceFloatOverride => { let current_global_override = self.window_management_behaviour.float_override;