mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-08 22:15:14 +02:00
fix(wm): cross-border move direction awareness
This commit ensures that when moving across a monitor boundary to the left, a container will be added to the back of the Ring<Container> of the target workspace, and when moving across a monitor boundary to the right, that it will be added to the front.
This commit is contained in:
@@ -19,6 +19,8 @@ install-target target:
|
|||||||
install:
|
install:
|
||||||
just install-target komorebic
|
just install-target komorebic
|
||||||
just install-target komorebic-no-console
|
just install-target komorebic-no-console
|
||||||
|
just install-target komorebi-gui
|
||||||
|
just install-target komorebi-bar
|
||||||
just install-target komorebi
|
just install-target komorebi
|
||||||
|
|
||||||
run:
|
run:
|
||||||
|
|||||||
@@ -1424,12 +1424,28 @@ impl WindowManager {
|
|||||||
// get a mutable ref to the focused workspace on the target monitor
|
// get a mutable ref to the focused workspace on the target monitor
|
||||||
let target_workspace = self.focused_workspace_mut()?;
|
let target_workspace = self.focused_workspace_mut()?;
|
||||||
|
|
||||||
// insert the origin container into the focused workspace on the target monitor
|
match direction {
|
||||||
// at the position where the currently focused container on that workspace is
|
OperationDirection::Left => {
|
||||||
target_workspace.insert_container_at_idx(
|
// insert the origin container into the focused workspace on the target monitor
|
||||||
target_workspace.focused_container_idx(),
|
// at the back if we are moving across a boundary to the left (back = right side
|
||||||
origin_container,
|
// of the target)
|
||||||
);
|
target_workspace.add_container_to_back(origin_container);
|
||||||
|
}
|
||||||
|
OperationDirection::Right => {
|
||||||
|
// insert the origin container into the focused workspace on the target monitor
|
||||||
|
// at the front if we are moving across a boundary to the right (front = left side
|
||||||
|
// of the target)
|
||||||
|
target_workspace.add_container_to_front(origin_container);
|
||||||
|
}
|
||||||
|
OperationDirection::Up | OperationDirection::Down => {
|
||||||
|
// insert the origin container into the focused workspace on the target monitor
|
||||||
|
// at the position where the currently focused container on that workspace is
|
||||||
|
target_workspace.insert_container_at_idx(
|
||||||
|
target_workspace.focused_container_idx(),
|
||||||
|
origin_container,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// if there is only one container on the target workspace after the insertion
|
// if there is only one container on the target workspace after the insertion
|
||||||
// it means that there won't be one swapped back, so we have to decrement the
|
// it means that there won't be one swapped back, so we have to decrement the
|
||||||
|
|||||||
Reference in New Issue
Block a user