mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-28 12:11:59 +01:00
fix(ffm): follow focus across monitor boundaries
This commit ensures that when the komorebi focus follows mouse implementation is enabled, the focus will follow the mouse across monitor bounadries.
This commit is contained in:
@@ -614,6 +614,7 @@ impl WindowManager {
|
||||
let mut hwnd = None;
|
||||
|
||||
let workspace = self.focused_workspace()?;
|
||||
// first check the focused workspace
|
||||
if let Some(container_idx) = workspace.container_idx_from_current_point() {
|
||||
if let Some(container) = workspace.containers().get(container_idx) {
|
||||
if let Some(window) = container.focused_window() {
|
||||
@@ -622,6 +623,34 @@ impl WindowManager {
|
||||
}
|
||||
}
|
||||
|
||||
// then check all workspaces
|
||||
if hwnd.is_none() {
|
||||
for monitor in self.monitors() {
|
||||
for ws in monitor.workspaces() {
|
||||
if let Some(container_idx) = ws.container_idx_from_current_point() {
|
||||
if let Some(container) = ws.containers().get(container_idx) {
|
||||
if let Some(window) = container.focused_window() {
|
||||
hwnd = Some(window.hwnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finally try matching the other way using a hwnd returned from the cursor pos
|
||||
if hwnd.is_none() {
|
||||
let cursor_pos_hwnd = WindowsApi::window_at_cursor_pos()?;
|
||||
|
||||
for monitor in self.monitors() {
|
||||
for ws in monitor.workspaces() {
|
||||
if ws.container_for_window(cursor_pos_hwnd).is_some() {
|
||||
hwnd = Some(cursor_pos_hwnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(hwnd) = hwnd {
|
||||
if self.has_pending_raise_op
|
||||
|| self.focused_window()?.hwnd == hwnd
|
||||
|
||||
Reference in New Issue
Block a user