mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-17 06:19:45 +02:00
fix(wm): respect horizontal focus from monocle
This commit ensures that horizontal focus moves onto other monitors from a monocle container are respected (ie. we don't try moving left/right within the workspace on the focused monitor). Additionally, if the user tries to alt-tab a window to the foreground on a workspace where a monocle container exists, the window will flash before being hidden behind the monocle container as a visual cue that monocle mode needs to be disabled to access that window. This is in contrast to the current behaviour where that window floats on top of the monocle container in a somewhat broken state. re #834
This commit is contained in:
@@ -334,8 +334,10 @@ impl WindowManager {
|
||||
if proceed {
|
||||
let behaviour = self.window_container_behaviour;
|
||||
let workspace = self.focused_workspace_mut()?;
|
||||
let workspace_contains_window = workspace.contains_window(window.hwnd);
|
||||
let monocle_container = workspace.monocle_container().clone();
|
||||
|
||||
if !workspace.contains_window(window.hwnd) && !needs_reconciliation {
|
||||
if !workspace_contains_window && !needs_reconciliation {
|
||||
match behaviour {
|
||||
WindowContainerBehaviour::Create => {
|
||||
workspace.new_container_for_window(window);
|
||||
@@ -350,6 +352,21 @@ impl WindowManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if workspace_contains_window {
|
||||
let mut monocle_window_event = false;
|
||||
if let Some(ref monocle) = monocle_container {
|
||||
if let Some(monocle_window) = monocle.focused_window() {
|
||||
if monocle_window.hwnd == window.hwnd {
|
||||
monocle_window_event = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !monocle_window_event && monocle_container.is_some() {
|
||||
window.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
WindowManagerEvent::MoveResizeStart(_, window) => {
|
||||
|
||||
@@ -1129,7 +1129,11 @@ impl WindowManager {
|
||||
|
||||
tracing::info!("focusing container");
|
||||
|
||||
let new_idx = workspace.new_idx_for_direction(direction);
|
||||
let new_idx = if workspace.monocle_container().is_some() {
|
||||
None
|
||||
} else {
|
||||
workspace.new_idx_for_direction(direction)
|
||||
};
|
||||
|
||||
let mut cross_monitor_monocle = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user