mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-12-23 12:09:55 +00:00
added power status for single battery
This commit is contained in:
7
neofetch
7
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"
|
||||||
|
|
||||||
@@ -1572,14 +1573,14 @@ getbattery () {
|
|||||||
"bar") prin "${title}${index}: $(bar ${bat/'%'} 100)" ;;
|
"bar") prin "${title}${index}: $(bar ${bat/'%'} 100)" ;;
|
||||||
"infobar") prin "${title}${index}: ${bat}% $(bar "${bat/'%'}" 100)" ;;
|
"infobar") prin "${title}${index}: ${bat}% $(bar "${bat/'%'}" 100)" ;;
|
||||||
"barinfo") prin "${title}${index}: $(bar "${bat/'%'}" 100) ${bat}%" ;;
|
"barinfo") prin "${title}${index}: $(bar "${bat/'%'}" 100) ${bat}%" ;;
|
||||||
*) prin "${title}${index}: ${bat}%" ;;
|
*) prin "${title}${index}: ${bat}% " ;;
|
||||||
esac
|
esac
|
||||||
index=$((index + 1))
|
index=$((index + 1))
|
||||||
done
|
done
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
battery="${batteries[0]}%"
|
battery="${batteries[0]}% ${power_status}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
battery="None"
|
battery="None"
|
||||||
|
|||||||
Reference in New Issue
Block a user