feat(wm): add send-to-monitor-workspace cmd

This commit adds a dedicated command to send a window container to a
specific workspace on a target monitor.
This commit is contained in:
LGUG2Z
2022-01-28 08:23:05 -08:00
parent 4a3f7ee34e
commit 02c54734fb
7 changed files with 53 additions and 10 deletions

View File

@@ -59,10 +59,19 @@ impl Monitor {
Ok(())
}
pub fn add_container(&mut self, container: Container) -> Result<()> {
let workspace = self
.focused_workspace_mut()
.ok_or_else(|| anyhow!("there is no workspace"))?;
pub fn add_container(
&mut self,
container: Container,
workspace_idx: Option<usize>,
) -> Result<()> {
let workspace = if let Some(idx) = workspace_idx {
self.workspaces_mut()
.get_mut(idx)
.ok_or_else(|| anyhow!("there is no workspace at index {}", idx))?
} else {
self.focused_workspace_mut()
.ok_or_else(|| anyhow!("there is no workspace"))?
};
workspace.add_container(container);