feat(idle): add status class

This commit is contained in:
Alex 2019-03-10 10:29:06 +01:00
parent 94d7b083c5
commit 973cec1713
2 changed files with 7 additions and 0 deletions

View File

@ -109,3 +109,8 @@ window#waybar {
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}

View File

@ -27,6 +27,7 @@ auto waybar::modules::IdleInhibitor::update() -> void
label_.set_markup(
fmt::format(format_, fmt::arg("status", status_),
fmt::arg("icon", getIcon(0, status_))));
label_.get_style_context()->add_class(status_);
if(tooltipEnabled()) {
label_.set_tooltip_text(status_);
}
@ -34,6 +35,7 @@ auto waybar::modules::IdleInhibitor::update() -> void
bool waybar::modules::IdleInhibitor::handleToggle(GdkEventButton* const& e) {
if (e->button == 1) {
label_.get_style_context()->remove_class(status_);
if (idle_inhibitor_) {
zwp_idle_inhibitor_v1_destroy(idle_inhibitor_);
idle_inhibitor_ = nullptr;