Merge branch 'battery_status' of https://github.com/dawidd6/neofetch into battery_status_mac
This commit is contained in:
commit
2146f6d214
1 changed files with 13 additions and 3 deletions
14
neofetch
14
neofetch
|
@ -1551,7 +1551,8 @@ getbattery () {
|
|||
|
||||
# Create an array of battery usage from each battery.
|
||||
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.
|
||||
title="$subtitle"
|
||||
|
||||
|
@ -1578,9 +1579,12 @@ getbattery () {
|
|||
done
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $power_status = "Charging" ]; then
|
||||
battery="${batteries[0]}% ${power_status}"
|
||||
else
|
||||
battery="${batteries[0]}%"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
battery="None"
|
||||
fi
|
||||
|
@ -1589,7 +1593,13 @@ getbattery () {
|
|||
"BSD")
|
||||
case "$distro" in
|
||||
"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}')
|
||||
fi
|
||||
;;
|
||||
|
||||
"NetBSD"*)
|
||||
|
|
Loading…
Reference in a new issue