Merge branch 'battery_status' of https://github.com/dawidd6/neofetch into battery_status_mac
This commit is contained in:
commit
2146f6d214
16
neofetch
16
neofetch
|
@ -1551,7 +1551,8 @@ getbattery () {
|
||||||
|
|
||||||
# Create an array of battery usage from each battery.
|
# Create an array of battery usage from each battery.
|
||||||
batteries=($(cat /sys/class/power_supply/BAT${battery_num}/capacity))
|
batteries=($(cat /sys/class/power_supply/BAT${battery_num}/capacity))
|
||||||
|
# Get the power status
|
||||||
|
power_status=($(cat /sys/class/power_supply/BAT${battery_num}/status))
|
||||||
# Get the subtitle and reassign it so it doesn't change.
|
# Get the subtitle and reassign it so it doesn't change.
|
||||||
title="$subtitle"
|
title="$subtitle"
|
||||||
|
|
||||||
|
@ -1578,8 +1579,11 @@ getbattery () {
|
||||||
done
|
done
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
if [ $power_status = "Charging" ]; then
|
||||||
battery="${batteries[0]}%"
|
battery="${batteries[0]}% ${power_status}"
|
||||||
|
else
|
||||||
|
battery="${batteries[0]}%"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
battery="None"
|
battery="None"
|
||||||
|
@ -1589,7 +1593,13 @@ getbattery () {
|
||||||
"BSD")
|
"BSD")
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
"FreeBSD"*)
|
"FreeBSD"*)
|
||||||
|
power_status=$(acpiconf -i 0 | awk -F ':\t\t\t' '/State/ {print $2}')
|
||||||
|
|
||||||
|
if [ $power_status = "charging" ]; then
|
||||||
|
battery="$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}') $power_status"
|
||||||
|
else
|
||||||
battery=$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}')
|
battery=$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}')
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"NetBSD"*)
|
"NetBSD"*)
|
||||||
|
|
Reference in New Issue