From be66cc2dd1fd6ac484c42c2f06be4dcf57e51b1a Mon Sep 17 00:00:00 2001 From: Alexis Date: Wed, 15 Aug 2018 15:03:51 +0200 Subject: [PATCH] feat(workspaces): add urgent, visible class --- README.md | 1 + resources/style.css | 2 +- src/modules/workspaces.cpp | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 249bb289..2451c778 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ - Memory - Cpu load average - Custom scripts +- And much more customizations **Configuration and Customization** diff --git a/resources/style.css b/resources/style.css index 0778a894..2c92e824 100644 --- a/resources/style.css +++ b/resources/style.css @@ -22,7 +22,7 @@ window { font-size: 10px; } -#workspaces button.current { +#workspaces button.focused { background: #64727D; border-bottom: 3px solid white; } diff --git a/src/modules/workspaces.cpp b/src/modules/workspaces.cpp index bd11c5cb..a227f6f6 100644 --- a/src/modules/workspaces.cpp +++ b/src/modules/workspaces.cpp @@ -53,9 +53,17 @@ auto waybar::modules::Workspaces::update() -> void } else { auto &button = it->second; if (node["focused"].asBool()) - button.get_style_context()->add_class("current"); + button.get_style_context()->add_class("focused"); 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) _box.reorder_child(button, node["num"].asInt()); button.show(); @@ -89,7 +97,11 @@ void waybar::modules::Workspaces::_addWorkspace(Json::Value node) .connect(sigc::mem_fun(*this, &Workspaces::_handleScroll)); _box.reorder_child(button, node["num"].asInt()); 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(); }