sway/workspaces: implement reverse-scroll

This commit is contained in:
xb-bx
2025-02-08 19:16:59 +02:00
parent cae5f9a56f
commit 4d74bb3004
2 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,11 @@ Addressed by *sway/workspaces*
default: false ++
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*: ++
typeof: bool ++
default: false ++

View File

@ -443,10 +443,11 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
if (it == workspaces_.end()) {
return true;
}
bool reverse_scroll = config_["reverse-scroll"].isBool() && config_["reverse-scroll"].asBool();
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) {
name = getCycleWorkspace(it, true);
name = getCycleWorkspace(it, reverse_scroll ? false : true);
} else {
return true;
}