feat(workspaces): add urgent, visible class

This commit is contained in:
Alexis 2018-08-15 15:03:51 +02:00
parent 52e7b6148b
commit be66cc2dd1
3 changed files with 17 additions and 4 deletions

View File

@ -13,6 +13,7 @@
- Memory - Memory
- Cpu load average - Cpu load average
- Custom scripts - Custom scripts
- And much more customizations
**Configuration and Customization** **Configuration and Customization**

View File

@ -22,7 +22,7 @@ window {
font-size: 10px; font-size: 10px;
} }
#workspaces button.current { #workspaces button.focused {
background: #64727D; background: #64727D;
border-bottom: 3px solid white; border-bottom: 3px solid white;
} }

View File

@ -53,9 +53,17 @@ auto waybar::modules::Workspaces::update() -> void
} else { } else {
auto &button = it->second; auto &button = it->second;
if (node["focused"].asBool()) if (node["focused"].asBool())
button.get_style_context()->add_class("current"); button.get_style_context()->add_class("focused");
else else
button.get_style_context()->remove_class("current"); button.get_style_context()->remove_class("focused");
if (node["visible"].asBool())
button.get_style_context()->add_class("visible");
else
button.get_style_context()->remove_class("visible");
if (node["urgent"].asBool())
button.get_style_context()->add_class("urgent");
else
button.get_style_context()->remove_class("urgent");
if (needReorder) if (needReorder)
_box.reorder_child(button, node["num"].asInt()); _box.reorder_child(button, node["num"].asInt());
button.show(); button.show();
@ -89,7 +97,11 @@ void waybar::modules::Workspaces::_addWorkspace(Json::Value node)
.connect(sigc::mem_fun(*this, &Workspaces::_handleScroll)); .connect(sigc::mem_fun(*this, &Workspaces::_handleScroll));
_box.reorder_child(button, node["num"].asInt()); _box.reorder_child(button, node["num"].asInt());
if (node["focused"].asBool()) if (node["focused"].asBool())
button.get_style_context()->add_class("current"); button.get_style_context()->add_class("focused");
if (node["visible"].asBool())
button.get_style_context()->add_class("visible");
if (node["urgent"].asBool())
button.get_style_context()->add_class("urgent");
button.show(); button.show();
} }