style(battery): animates background when battery is in a critical state

pull/18/head
Alexis 2018-08-11 13:03:35 +02:00
parent 6ff296a4b0
commit 67fa8bd4c3
2 changed files with 13 additions and 1 deletions

View File

@ -42,9 +42,21 @@ window {
background-color: #26A65B; background-color: #26A65B;
} }
@keyframes blink {
to {
background-color: #ffffff;
color: black;
}
}
.battery.warning { .battery.warning {
background: #f53c3c; background: #f53c3c;
color: white; color: white;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
} }
.cpu { .cpu {

View File

@ -50,7 +50,7 @@ auto waybar::modules::Battery::update() -> void
_label.get_style_context()->add_class("charging"); _label.get_style_context()->add_class("charging");
else else
_label.get_style_context()->remove_class("charging"); _label.get_style_context()->remove_class("charging");
if (value < 52 && !charging) if (value < 16 && !charging)
_label.get_style_context()->add_class("warning"); _label.get_style_context()->add_class("warning");
else else
_label.get_style_context()->remove_class("warning"); _label.get_style_context()->remove_class("warning");