mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix(workspaces): reorder child if needed on focus
This commit is contained in:
parent
00e5a1a7d5
commit
45832fcbe3
@ -50,11 +50,13 @@ void waybar::modules::Workspaces::updateThread()
|
|||||||
auto waybar::modules::Workspaces::update() -> void
|
auto waybar::modules::Workspaces::update() -> void
|
||||||
{
|
{
|
||||||
Json::Value workspaces = _getWorkspaces();
|
Json::Value workspaces = _getWorkspaces();
|
||||||
|
bool hided = false;
|
||||||
for (auto it = _buttons.begin(); it != _buttons.end(); ++it) {
|
for (auto it = _buttons.begin(); it != _buttons.end(); ++it) {
|
||||||
auto ws = std::find_if(workspaces.begin(), workspaces.end(),
|
auto ws = std::find_if(workspaces.begin(), workspaces.end(),
|
||||||
[it](auto node) -> bool { return node["num"].asInt() == it->first; });
|
[it](auto node) -> bool { return node["num"].asInt() == it->first; });
|
||||||
if (ws == workspaces.end()) {
|
if (ws == workspaces.end()) {
|
||||||
it->second.hide();
|
it->second.hide();
|
||||||
|
hided = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto node : workspaces) {
|
for (auto node : workspaces) {
|
||||||
@ -69,6 +71,9 @@ auto waybar::modules::Workspaces::update() -> void
|
|||||||
} else if (!styleContext->has_class("current") && isCurrent) {
|
} else if (!styleContext->has_class("current") && isCurrent) {
|
||||||
styleContext->add_class("current");
|
styleContext->add_class("current");
|
||||||
}
|
}
|
||||||
|
if (hided) {
|
||||||
|
_box->reorder_child(it->second, node["num"].asInt() - 1);
|
||||||
|
}
|
||||||
it->second.show();
|
it->second.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user