From b18cb584165450666d1eab5b76ef8c2e6caac93b Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 18:53:57 -0700 Subject: [PATCH] refactor(windows): the lock and unlock arms call komorebi-core BEHAVIOUR (Windows runtime): LockMonitorWorkspaceContainer and UnlockMonitorWorkspaceContainer call komorebi_core::set_container_locked (the text the Windows arms had byte for byte), and WindowManager implements ContainerCommandHost. By construction the same; marked because it was only type-checked. Windows e2e scenarios needed: commands (toggle-lock, and lock/unlock by index if the sweep has them), stacking. Verified: Windows cargo clippy -p komorebi-windows --locked --all-targets -D warnings: PASS. Not run: Windows tests, e2e. --- komorebi/src/process_command.rs | 50 +++++++++++++-------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index 5ff03bd9..69eda0d8 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -435,40 +435,24 @@ impl WindowManager { monitor_idx, workspace_idx, container_idx, - ) => { - let monitor = self - .monitors_mut() - .get_mut(monitor_idx) - .ok_or_eyre("no monitor at the given index")?; - - let workspace = monitor - .workspaces_mut() - .get_mut(workspace_idx) - .ok_or_eyre("no workspace at the given index")?; - - if let Some(container) = workspace.containers_mut().get_mut(container_idx) { - container.locked = true; - } - } + ) => komorebi_core::set_container_locked( + self, + monitor_idx, + workspace_idx, + container_idx, + true, + )?, SocketMessage::UnlockMonitorWorkspaceContainer( monitor_idx, workspace_idx, container_idx, - ) => { - let monitor = self - .monitors_mut() - .get_mut(monitor_idx) - .ok_or_eyre("no monitor at the given index")?; - - let workspace = monitor - .workspaces_mut() - .get_mut(workspace_idx) - .ok_or_eyre("no workspace at the given index")?; - - if let Some(container) = workspace.containers_mut().get_mut(container_idx) { - container.locked = false; - } - } + ) => komorebi_core::set_container_locked( + self, + monitor_idx, + workspace_idx, + container_idx, + false, + )?, SocketMessage::ToggleLock => self.toggle_lock()?, SocketMessage::ToggleFloat => self.toggle_float(false)?, SocketMessage::ToggleMonocle => self.toggle_monocle()?, @@ -2357,6 +2341,12 @@ impl komorebi_core::MonitorCommandHost for WindowManager { } } +impl komorebi_core::ContainerCommandHost for WindowManager { + fn monitors_mut(&mut self) -> &mut std::collections::VecDeque { + WindowManager::monitors_mut(self) + } +} + #[cfg(test)] mod tests { use super::push_simple_rule;