MCPcopy Create free account
hub / github.com/Alexays/Waybar / getCycleWorkspace

Method getCycleWorkspace

src/modules/sway/workspaces.cpp:472–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472std::string Workspaces::getCycleWorkspace(std::vector<Json::Value>::iterator it, bool prev) const {
473 if (prev && it == workspaces_.begin() && !config_["disable-scroll-wraparound"].asBool()) {
474 return (*(--workspaces_.end()))["name"].asString();
475 }
476 if (prev && it != workspaces_.begin())
477 --it;
478 else if (!prev && it != workspaces_.end())
479 ++it;
480 if (!prev && it == workspaces_.end()) {
481 if (config_["disable-scroll-wraparound"].asBool()) {
482 --it;
483 } else {
484 return (*(workspaces_.begin()))["name"].asString();
485 }
486 }
487 return (*it)["name"].asString();
488}
489
490std::string Workspaces::trimWorkspaceName(std::string name) {
491 std::size_t found = name.find(':');

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected