diff --git a/neofetch b/neofetch index cfaea51b..e4542966 100755 --- a/neofetch +++ b/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,8 +1579,11 @@ getbattery () { done return fi - - battery="${batteries[0]}%" + if [ $power_status = "Charging" ]; then + battery="${batteries[0]}% ${power_status}" + else + battery="${batteries[0]}%" + fi fi else battery="None" @@ -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"*)