From bab5fac915f51b85eef51509f7aba49368f4c199 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 18:52:25 -0700 Subject: [PATCH] refactor(kde): the lock and unlock arms call komorebi-core LockMonitorWorkspaceContainer and UnlockMonitorWorkspaceContainer call komorebi_core::set_container_locked, and WindowManager implements ContainerCommandHost with its own monitors_mut. No behaviour change. Verified: KDE cargo test -p komorebi-linux (lite env): 678 passed, 0 failed. Not run: VM suites. --- .../komorebi/src/process_command.rs | 50 ++++++++----------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/komorebi-for-kde/komorebi/src/process_command.rs b/komorebi-for-kde/komorebi/src/process_command.rs index cafeb960..7208edb5 100644 --- a/komorebi-for-kde/komorebi/src/process_command.rs +++ b/komorebi-for-kde/komorebi/src/process_command.rs @@ -1362,40 +1362,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::FlipLayout(layout_flip) => self.flip_layout(layout_flip)?, SocketMessage::ChangeLayout(layout) => self.change_workspace_layout_default(layout)?, SocketMessage::CycleLayout(direction) => self.cycle_layout(direction)?, @@ -2110,6 +2094,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::*;