Skip to content

Commit

Permalink
Merge pull request #67 from levnikmyskin/fix-removal-windows-on-works…
Browse files Browse the repository at this point in the history
…pace

fix: fix removal of getWindowsOnWorkspace
  • Loading branch information
levnikmyskin authored Nov 25, 2024
2 parents 863acc3 + 525670f commit 86870aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/VirtualDesk.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "VirtualDesk.hpp"
#include "src/Compositor.hpp"
#include <numeric>
#include <algorithm>
#include <unordered_set>
Expand Down Expand Up @@ -121,10 +122,13 @@ CSharedPointer<CMonitor> VirtualDesk::firstAvailableMonitor(const std::vector<CS
int n = INT_MAX;
CSharedPointer<CMonitor> 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;
Expand Down
10 changes: 8 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 86870aa

Please sign in to comment.