Merge pull request #3336 from pjones/pjones/current-only

This commit is contained in:
Alexis Rouillard 2024-06-07 08:35:02 +02:00 committed by GitHub
commit f4da203915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -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();