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.
This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:26 -08:00
1 parent 1aa9c580de
commit b18cb58416
1 file changed
+20 -30
+20 -30
View File
@@ -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<crate::monitor::Monitor> {
WindowManager::monitors_mut(self)
}
}
#[cfg(test)]
mod tests {
use super::push_simple_rule;