sway/workspaces: Fix scroll on unfocused monitor

This commit is contained in:
vawvaw 2024-04-18 21:52:53 +02:00
parent 8ef4ddd7ef
commit f75b2ae91f
No known key found for this signature in database
GPG Key ID: 2B5C881514F81286
1 changed files with 9 additions and 2 deletions

View File

@ -434,9 +434,16 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
}
std::string name;
{
bool alloutputs = config_["all-outputs"].asBool();
std::lock_guard<std::mutex> lock(mutex_);
auto it = std::find_if(workspaces_.begin(), workspaces_.end(),
[](const auto &workspace) { return hasFlag(workspace, "focused"); });
auto it =
std::find_if(workspaces_.begin(), workspaces_.end(), [alloutputs](const auto &workspace) {
if (alloutputs) {
return hasFlag(workspace, "focused");
}
bool noNodes = workspace["nodes"].empty() && workspace["floating_nodes"].empty();
return hasFlag(workspace, "visible") || (workspace["output"].isString() && noNodes);
});
if (it == workspaces_.end()) {
return true;
}