mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-10 15:12:52 +02:00
feat(wm): focus to last container across monitors
This commit ensures that when focusing across a monitor boundary, the focus will go to the last focused window container on the focused workspace on the other side of a given window boundary. re #145
This commit is contained in:
@@ -940,19 +940,19 @@ impl WindowManager {
|
|||||||
let new_idx = workspace.new_idx_for_direction(direction);
|
let new_idx = workspace.new_idx_for_direction(direction);
|
||||||
|
|
||||||
// if there is no container in that direction for this workspace
|
// if there is no container in that direction for this workspace
|
||||||
if new_idx.is_none() {
|
match new_idx {
|
||||||
// check if there is a monitor in that direction
|
None => {
|
||||||
let monitor_idx = self
|
let monitor_idx = self
|
||||||
.monitor_index_in_direction(direction)
|
.monitor_index_in_direction(direction)
|
||||||
.ok_or_else(|| anyhow!("there is no container or monitor in this direction"))?;
|
.ok_or_else(|| anyhow!("there is no container or monitor in this direction"))?;
|
||||||
self.focus_monitor(monitor_idx)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
let workspace = self.focused_workspace_mut()?;
|
self.focus_monitor(monitor_idx)?;
|
||||||
workspace.focus_container(new_idx.unwrap_or_else(|| match direction {
|
}
|
||||||
OperationDirection::Right | OperationDirection::Down => 0,
|
Some(idx) => {
|
||||||
OperationDirection::Left | OperationDirection::Up => workspace.containers().len() - 1,
|
let workspace = self.focused_workspace_mut()?;
|
||||||
}));
|
workspace.focus_container(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.focused_window_mut()?.focus(self.mouse_follows_focus)?;
|
self.focused_window_mut()?.focus(self.mouse_follows_focus)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user