Skip to content

Commit

Permalink
Merge pull request #3336 from pjones/pjones/current-only
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Jun 7, 2024
2 parents 365e77a + 637b220 commit f4da203
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,16 @@ std::string Workspaces::trimWorkspaceName(std::string name) {

void Workspaces::onButtonReady(const Json::Value &node, Gtk::Button &button) {
if (config_["current-only"].asBool()) {
if (node["focused"].asBool()) {
// If a workspace has a focused container then get_tree will say
// that the workspace itself isn't focused. Therefore we need to
// check if any of its nodes are focused as well.
bool focused = node["focused"].asBool() ||
std::any_of(node["nodes"].begin(), node["nodes"].end(),
[](const auto &child) {
return child["focused"].asBool();
});

if (focused) {
button.show();
} else {
button.hide();
Expand Down

0 comments on commit f4da203

Please sign in to comment.