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