Merge pull request #3929 from xb-bx/master

sway/workspaces: Implement reverse-scroll
This commit is contained in:
Alexis Rouillard 2025-08-08 08:45:42 +02:00 committed by GitHub
commit 61b3c6d7d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,11 @@ Addressed by *sway/workspaces*
default: false ++ default: false ++
If set to false, you can scroll to cycle through workspaces. If set to true this behaviour is disabled. If set to false, you can scroll to cycle through workspaces. If set to true this behaviour is disabled.
*reverse-scroll*: ++
typeof: bool ++
default: false ++
If set to false, scrolling up will switch to the previous workspace and scrolling down will switch to the next workspace. If set to true, the behavior will be reversed.
*disable-click*: ++ *disable-click*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++

View File

@ -443,10 +443,11 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
if (it == workspaces_.end()) { if (it == workspaces_.end()) {
return true; return true;
} }
bool reverse_scroll = config_["reverse-scroll"].isBool() && config_["reverse-scroll"].asBool();
if (dir == SCROLL_DIR::DOWN || dir == SCROLL_DIR::RIGHT) { if (dir == SCROLL_DIR::DOWN || dir == SCROLL_DIR::RIGHT) {
name = getCycleWorkspace(it, false); name = getCycleWorkspace(it, reverse_scroll ? true : false);
} else if (dir == SCROLL_DIR::UP || dir == SCROLL_DIR::LEFT) { } else if (dir == SCROLL_DIR::UP || dir == SCROLL_DIR::LEFT) {
name = getCycleWorkspace(it, true); name = getCycleWorkspace(it, reverse_scroll ? false : true);
} else { } else {
return true; return true;
} }