fix(Workspaces): index
parent
add9e925f4
commit
93173851d3
|
@ -228,9 +228,15 @@ std::string waybar::modules::sway::Workspaces::getNextWorkspace()
|
||||||
|
|
||||||
uint16_t waybar::modules::sway::Workspaces::getWorkspaceIndex(const std::string &name)
|
uint16_t waybar::modules::sway::Workspaces::getWorkspaceIndex(const std::string &name)
|
||||||
{
|
{
|
||||||
for (uint16_t i = 0; i < workspaces_.size(); i += 1) {
|
uint16_t idx = 0;
|
||||||
if (workspaces_[i]["name"].asString() == name) {
|
for (const auto &workspace : workspaces_) {
|
||||||
return i;
|
if (workspace["name"].asString() == name) {
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
if (!config_["all-outputs"].asBool() && workspace["output"].asString() != bar_.output_name) {
|
||||||
|
// Nothing here
|
||||||
|
} else {
|
||||||
|
idx += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return workspaces_.size();
|
return workspaces_.size();
|
||||||
|
|
Loading…
Reference in New Issue