Fix workspace scroll wrapping off the end of the list

This commit is contained in:
RX14 2019-05-17 17:37:24 +01:00
parent 9234be8544
commit 1e95f5d9b6
No known key found for this signature in database
GPG Key ID: CEF2BBFE18BD0E67
1 changed files with 2 additions and 2 deletions

View File

@ -223,7 +223,7 @@ 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()) {
return (*(++workspaces_.begin()))["name"].asString(); return (*(workspaces_.begin()))["name"].asString();
} }
return (*it)["name"].asString(); return (*it)["name"].asString();
} }
@ -250,4 +250,4 @@ void Workspaces::onButtonReady(const Json::Value &node, Gtk::Button &button) {
Workspaces::operator Gtk::Widget &() { return box_; } Workspaces::operator Gtk::Widget &() { return box_; }
} // namespace waybar::modules::sway } // namespace waybar::modules::sway