diff --git a/src/VirtualDesk.cpp b/src/VirtualDesk.cpp index 4e13ca0..4002cad 100644 --- a/src/VirtualDesk.cpp +++ b/src/VirtualDesk.cpp @@ -1,4 +1,5 @@ #include "VirtualDesk.hpp" +#include "src/Compositor.hpp" #include #include #include @@ -121,10 +122,13 @@ CSharedPointer VirtualDesk::firstAvailableMonitor(const std::vector newMonitor; for (const auto& mon : currentlyEnabledMonitors()) { - auto n_on_mon = g_pCompositor->getWindowsOnWorkspace(mon->activeWorkspaceID()); - if (n_on_mon < n) { - n = n_on_mon; - newMonitor = mon; + auto workspace = g_pCompositor->getWorkspaceByID(mon->activeWorkspaceID()); + if (workspace) { + auto n_on_mon = workspace->getWindows(); + if (n_on_mon < n) { + n = n_on_mon; + newMonitor = mon; + } } } return newMonitor; diff --git a/src/main.cpp b/src/main.cpp index c7d21c8..385c0da 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -184,7 +184,10 @@ std::string printStateDispatch(eHyprCtlOutputFormat format, std::string arg) { std::string workspaces; bool first = true; for (auto const& [monitor, workspaceId] : desk->activeLayout(manager->conf)) { - windows += g_pCompositor->getWindowsOnWorkspace(workspaceId); + auto workspace = g_pCompositor->getWorkspaceByID(workspaceId); + if (workspace) { + windows += workspace->getWindows(); + } if (!first) workspaces += ", "; else @@ -204,7 +207,10 @@ std::string printStateDispatch(eHyprCtlOutputFormat format, std::string arg) { std::string workspaces; bool first = true; for (auto const& [monitor, workspaceId] : desk->activeLayout(manager->conf)) { - windows += g_pCompositor->getWindowsOnWorkspace(workspaceId); + auto workspace = g_pCompositor->getWorkspaceByID(workspaceId); + if (workspace) { + windows += workspace->getWindows(); + } if (!first) workspaces += ", "; else