From f75b2ae91f25a28462f6c3d54eaf0a3e851d210c Mon Sep 17 00:00:00 2001 From: vawvaw Date: Thu, 18 Apr 2024 21:52:53 +0200 Subject: [PATCH] sway/workspaces: Fix scroll on unfocused monitor --- src/modules/sway/workspaces.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/sway/workspaces.cpp b/src/modules/sway/workspaces.cpp index 925448c2..7517dc26 100644 --- a/src/modules/sway/workspaces.cpp +++ b/src/modules/sway/workspaces.cpp @@ -434,9 +434,16 @@ bool Workspaces::handleScroll(GdkEventScroll *e) { } std::string name; { + bool alloutputs = config_["all-outputs"].asBool(); std::lock_guard 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; }