6a89b574c7c01aab1b926144fbbfaab4e9aa183a
- Author
- outfoxxed <outfoxxed@outfoxxed.me>
- Committer
- outfoxxed <outfoxxed@outfoxxed.me>
- Date
Message
Fix getNextWindowCandidate not considering fullscreen or floating windows
Diff
1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
2index 14062728e1c10831a56bde7dc76d77419487bc21..981a2f256d2f80a2f3b8eb0a82e0062a6f6a65f2 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -3,6 +3,7 @@
6
7 #include <hyprland/src/Compositor.hpp>
8 #include <hyprland/src/plugins/PluginAPI.hpp>
9+#include <ranges>
10
11 #include "Hy3Layout.hpp"
12 #include "SelectionHook.hpp"
13@@ -689,6 +690,24 @@ void Hy3Layout::alterSplitRatio(CWindow* pWindow, float delta, bool exact) {
14 std::string Hy3Layout::getLayoutName() { return "hy3"; }
15
16 CWindow* Hy3Layout::getNextWindowCandidate(CWindow* window) {
17+ auto* workspace = g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID);
18+
19+ if (workspace->m_bHasFullscreenWindow) {
20+ return g_pCompositor->getFullscreenWindowOnWorkspace(window->m_iWorkspaceID);
21+ }
22+
23+ // return the first floating window on the same workspace that has not asked not to be focused
24+ if (window->m_bIsFloating) {
25+ for (std::unique_ptr<CWindow>& w: g_pCompositor->m_vWindows | std::views::reverse) {
26+ if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2
27+ && w->m_iWorkspaceID == window->m_iWorkspaceID && !w->m_bX11ShouldntFocus
28+ && !w->m_bNoFocus && w.get() != window)
29+ {
30+ return w.get();
31+ }
32+ }
33+ }
34+
35 auto* node = this->getWorkspaceFocusedNode(window->m_iWorkspaceID, true);
36 if (node == nullptr) return nullptr;
37