feat(idle): add status class
This commit is contained in:
parent
94d7b083c5
commit
973cec1713
|
@ -109,3 +109,8 @@ window#waybar {
|
||||||
#idle_inhibitor {
|
#idle_inhibitor {
|
||||||
background-color: #2d3436;
|
background-color: #2d3436;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#idle_inhibitor.activated {
|
||||||
|
background-color: #ecf0f1;
|
||||||
|
color: #2d3436;
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ auto waybar::modules::IdleInhibitor::update() -> void
|
||||||
label_.set_markup(
|
label_.set_markup(
|
||||||
fmt::format(format_, fmt::arg("status", status_),
|
fmt::format(format_, fmt::arg("status", status_),
|
||||||
fmt::arg("icon", getIcon(0, status_))));
|
fmt::arg("icon", getIcon(0, status_))));
|
||||||
|
label_.get_style_context()->add_class(status_);
|
||||||
if(tooltipEnabled()) {
|
if(tooltipEnabled()) {
|
||||||
label_.set_tooltip_text(status_);
|
label_.set_tooltip_text(status_);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +35,7 @@ auto waybar::modules::IdleInhibitor::update() -> void
|
||||||
|
|
||||||
bool waybar::modules::IdleInhibitor::handleToggle(GdkEventButton* const& e) {
|
bool waybar::modules::IdleInhibitor::handleToggle(GdkEventButton* const& e) {
|
||||||
if (e->button == 1) {
|
if (e->button == 1) {
|
||||||
|
label_.get_style_context()->remove_class(status_);
|
||||||
if (idle_inhibitor_) {
|
if (idle_inhibitor_) {
|
||||||
zwp_idle_inhibitor_v1_destroy(idle_inhibitor_);
|
zwp_idle_inhibitor_v1_destroy(idle_inhibitor_);
|
||||||
idle_inhibitor_ = nullptr;
|
idle_inhibitor_ = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue