feat(wm): auto toggle-monocle on alt-tab

This commit adds a change to automatically toggle monocle mode off on
the focused workspace when a window on the same workspace is
foregrounded by alt-tab.

resolve #834
This commit is contained in:
LGUG2Z
2024-05-19 11:08:04 -07:00
parent 2a45f981e6
commit bdf66cc362
+8 -1
View File
@@ -334,8 +334,10 @@ impl WindowManager {
if proceed { if proceed {
let behaviour = self.window_container_behaviour; let behaviour = self.window_container_behaviour;
let workspace = self.focused_workspace_mut()?; let workspace = self.focused_workspace_mut()?;
let workspace_contains_window = workspace.contains_window(window.hwnd);
let workspace_has_monocle_container = workspace.monocle_container().is_some();
if !workspace.contains_window(window.hwnd) && !needs_reconciliation { if !workspace_contains_window && !needs_reconciliation {
match behaviour { match behaviour {
WindowContainerBehaviour::Create => { WindowContainerBehaviour::Create => {
workspace.new_container_for_window(window); workspace.new_container_for_window(window);
@@ -350,6 +352,11 @@ impl WindowManager {
} }
} }
} }
if workspace_contains_window && workspace_has_monocle_container {
self.toggle_monocle()?;
window.focus(self.mouse_follows_focus)?;
}
} }
} }
WindowManagerEvent::MoveResizeStart(_, window) => { WindowManagerEvent::MoveResizeStart(_, window) => {