Skip to content

Commit

Permalink
sway/window: include floating_nodes when considering window count for…
Browse files Browse the repository at this point in the history
… class
  • Loading branch information
RobertMueller2 committed Oct 2, 2021
1 parent 7af6e84 commit 9972384
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/modules/sway/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,22 @@ auto Window::update() -> void {

int leafNodesInWorkspace(const Json::Value& node) {
auto const& nodes = node["nodes"];
if(nodes.empty()) {
auto const& floating_nodes = node["floating_nodes"];
if(nodes.empty() && floating_nodes.empty()) {
if(node["type"] == "workspace")
return 0;
else
return 1;
}
int sum = 0;
for(auto const& node : nodes)
sum += leafNodesInWorkspace(node);
if (!nodes.empty()) {
for(auto const& node : nodes)
sum += leafNodesInWorkspace(node);
}
if (!floating_nodes.empty()) {
for(auto const& node : floating_nodes)
sum += leafNodesInWorkspace(node);
}
return sum;
}

Expand Down

0 comments on commit 9972384

Please sign in to comment.