Skip to content

Commit

Permalink
Merge pull request #3148 from VAWVAW/sway-scroll
Browse files Browse the repository at this point in the history
sway/workspaces: Fix scroll on unfocused monitor
  • Loading branch information
Alexays authored Apr 19, 2024
2 parents 8ef4ddd + f75b2ae commit 95788e8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 95788e8

Please sign in to comment.