Skip to content

Commit

Permalink
feat(idle): add status class
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Mar 10, 2019
1 parent 94d7b08 commit 973cec1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resources/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,8 @@ window#waybar {
#idle_inhibitor {
background-color: #2d3436;
}

#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
2 changes: 2 additions & 0 deletions src/modules/idle_inhibitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ 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_);
}
}

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;
Expand Down

0 comments on commit 973cec1

Please sign in to comment.