5b0bc5213b135a4e064ac714c1ef7d95b44fe1b2

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

fix focusMonitor

Diff

 1diff --git a/CHANGELOG.md b/CHANGELOG.md
 2index 1efb001a36e4ea8ee52e8e95791b1b73c0781774..536293a13e82c3f2714143b357e360f45b8e6658 100644
 3--- a/CHANGELOG.md
 4+++ b/CHANGELOG.md
 5@@ -2,6 +2,7 @@
 6 
 7 # Upcoming
 8 
 9+- Fixed focus across monitors not working.
10 - Fixed makegroup toggle not working.
11 - Fixed window input area covering reserved area.
12 
13diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
14index 07dcd543ee99572d888128ca4deea51ec7e2e914..2c8bd282982e07ff5bde9a57afeca5e57ee49003 100644
15--- a/src/Hy3Layout.cpp
16+++ b/src/Hy3Layout.cpp
17@@ -834,11 +834,15 @@ Hy3Node* Hy3Layout::focusMonitor(ShiftDirection direction) {
18 			if (target_window) {
19 				found = true;
20 
21-				// Move the cursor to the window we selected
22-				auto found_node = getNodeFromWindow(target_window.get());
23-				if (found_node) {
24-					found_node->focus(true, Desktop::FOCUS_REASON_KEYBIND);
25-					return found_node;
26+				if (auto* hy3 = hy3InstanceForWorkspace(next_workspace)) {
27+					auto found_node = hy3->getNodeFromWindow(target_window.get());
28+					if (found_node) {
29+						found_node->focus(true, Desktop::FOCUS_REASON_KEYBIND);
30+						return found_node;
31+					}
32+				} else {
33+					Desktop::focusState()->fullWindowFocus(target_window, Desktop::FOCUS_REASON_KEYBIND);
34+					return nullptr;
35 				}
36 			}
37 		}