Merge pull request #327 from RX14/feature/disable-scroll-wraparound-option

Add option to disable scroll wraparound on workspaces
This commit is contained in:
Alex 2019-05-18 13:50:35 +02:00 committed by GitHub
commit e70d8aff73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -215,7 +215,7 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
const std::string Workspaces::getCycleWorkspace(std::vector<Json::Value>::iterator it, const std::string Workspaces::getCycleWorkspace(std::vector<Json::Value>::iterator it,
bool prev) const { bool prev) const {
if (prev && it == workspaces_.begin()) { if (prev && it == workspaces_.begin() && !config_["disable-scroll-wraparound"].asBool()) {
return (*(--workspaces_.end()))["name"].asString(); return (*(--workspaces_.end()))["name"].asString();
} }
if (prev && it != workspaces_.begin()) if (prev && it != workspaces_.begin())
@ -223,8 +223,12 @@ const std::string Workspaces::getCycleWorkspace(std::vector<Json::Value>::iterat
else if (!prev && it != workspaces_.end()) else if (!prev && it != workspaces_.end())
++it; ++it;
if (!prev && it == workspaces_.end()) { if (!prev && it == workspaces_.end()) {
if (config_["disable-scroll-wraparound"].asBool()) {
--it;
} else {
return (*(workspaces_.begin()))["name"].asString(); return (*(workspaces_.begin()))["name"].asString();
} }
}
return (*it)["name"].asString(); return (*it)["name"].asString();
} }