feat(wm): add cross boundary behaviour options

This commit introduces a new configuration option,
cross_boundary_behaviour, which allows the user to decide if they want
Focus and Move operations to operate across Workspace or Monitor
boundaries.

The default behaviour in komorebi has always been Monitor.  Setting this
to Workspace will make komorebi act a little like PaperWM, where
"komorebic focus left" and "komorebic focus right" will switch to the
next or previous workspace respectively if the currently focused window
as at either the left or right monitor boundary.

resolve #959
This commit is contained in:
LGUG2Z
2024-08-26 21:49:08 -07:00
parent 3c03528750
commit b799fd3077
7 changed files with 121 additions and 11 deletions
+8 -2
View File
@@ -17,6 +17,7 @@ use crate::core::Rect;
use crate::container::Container;
use crate::ring::Ring;
use crate::workspace::Workspace;
use crate::OperationDirection;
#[derive(
Debug,
@@ -114,7 +115,7 @@ impl Monitor {
.ok_or_else(|| anyhow!("there is no workspace"))?
};
workspace.add_container(container);
workspace.add_container_to_back(container);
Ok(())
}
@@ -149,6 +150,7 @@ impl Monitor {
&mut self,
target_workspace_idx: usize,
follow: bool,
direction: Option<OperationDirection>,
) -> Result<()> {
let workspace = self
.focused_workspace_mut()
@@ -173,7 +175,11 @@ impl Monitor {
Some(workspace) => workspace,
};
target_workspace.add_container(container);
if matches!(direction, Some(OperationDirection::Right)) {
target_workspace.add_container_to_front(container);
} else {
target_workspace.add_container_to_back(container);
}
if follow {
self.focus_workspace(target_workspace_idx)?;