Add color for battery.
This commit is contained in:
parent
e60ca1a4e4
commit
9dda4875c0
@ -76,11 +76,11 @@
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#battery.warning {
|
||||
#custom-battery.warning {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
#battery.critical {
|
||||
#custom-battery.critical {
|
||||
color: red;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ while true; do
|
||||
battery_percentage=$(apm -l)
|
||||
battery_status=$(apm -b)
|
||||
seconds_remaining=$(apm -t)
|
||||
class=""
|
||||
|
||||
if [ $battery_status -eq 3 ]; then
|
||||
if [ $battery_percentage -eq 100 ]; then
|
||||
@ -33,6 +34,13 @@ while true; do
|
||||
else
|
||||
battery_icon=""
|
||||
fi
|
||||
|
||||
if [ $battery_percentage -le 15 ]; then
|
||||
class="critical"
|
||||
elif [ $battery_percentage -le 30 ]; then
|
||||
class="warning"
|
||||
fi
|
||||
|
||||
if [ $seconds_remaining -eq -1 ]; then
|
||||
time_remaining="unknown time remaining."
|
||||
else
|
||||
@ -43,7 +51,8 @@ while true; do
|
||||
{
|
||||
"text":"${battery_percentage}% ${battery_icon}",
|
||||
"tooltip":"${time_remaining}",
|
||||
"percentage":${battery_percentage}
|
||||
"percentage":${battery_percentage},
|
||||
"class":"${class}"
|
||||
}
|
||||
EOF
|
||||
sleep $SLEEP_INTERVAL
|
||||
|
@ -13,6 +13,8 @@ while true; do
|
||||
text=""
|
||||
tooltip=""
|
||||
percentage=""
|
||||
class=""
|
||||
|
||||
while read bat; do
|
||||
battery_now=$(cat "$bat/charge_now")
|
||||
battery_capacity=$(cat "$bat/charge_full")
|
||||
@ -39,6 +41,13 @@ while true; do
|
||||
else
|
||||
battery_icon=""
|
||||
fi
|
||||
|
||||
if [ $battery_percentage -le 15 ]; then
|
||||
class="critical"
|
||||
elif [ $battery_percentage -le 30 ]; then
|
||||
class="warning"
|
||||
fi
|
||||
|
||||
if [ $seconds_remaining -eq -1 ]; then
|
||||
time_remaining="unknown time remaining."
|
||||
else
|
||||
@ -55,7 +64,8 @@ while true; do
|
||||
{
|
||||
"text":"$text",
|
||||
"tooltip":"$tooltip",
|
||||
"percentage":$percentage
|
||||
"percentage":${percentage},
|
||||
"class":"${class}"
|
||||
}
|
||||
EOF
|
||||
sleep $SLEEP_INTERVAL
|
||||
|
Loading…
x
Reference in New Issue
Block a user