refactor(mac): the lock and unlock arms call komorebi-core

The same two arms as on KDE call komorebi_core::set_container_locked, and
WindowManager implements ContainerCommandHost. 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).
This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:26 -08:00
1 parent bab5fac915
commit 1aa9c580de
1 file changed
+20 -30
@@ -542,40 +542,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)?,
@@ -1817,6 +1801,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 crate::SocketMessage;