Windows 10 (bash): Fix battery 2
This commit is contained in:
parent
7735fb02a5
commit
0871c362ef
3
neofetch
3
neofetch
|
@ -1595,13 +1595,14 @@ getbattery() {
|
||||||
for bat in "/sys/class/power_supply/BAT"*; do
|
for bat in "/sys/class/power_supply/BAT"*; do
|
||||||
capacity="$(< ${bat}/capacity)"
|
capacity="$(< ${bat}/capacity)"
|
||||||
status="$(< ${bat}/status)"
|
status="$(< ${bat}/status)"
|
||||||
battery="${capacity}% [${status}]"
|
|
||||||
|
|
||||||
# Fix for bash on Windows 10 which includes /proc files
|
# Fix for bash on Windows 10 which includes /proc files
|
||||||
# for battery usage despite there not being a battery
|
# for battery usage despite there not being a battery
|
||||||
# installed.
|
# installed.
|
||||||
[ -z "$capacity" ] && return
|
[ -z "$capacity" ] && return
|
||||||
|
|
||||||
|
battery="${capacity}% [${status}]"
|
||||||
|
|
||||||
case "$battery_display" in
|
case "$battery_display" in
|
||||||
"bar") battery="$(bar "$capacity" 100)" ;;
|
"bar") battery="$(bar "$capacity" 100)" ;;
|
||||||
"infobar") battery+=" $(bar "$capacity" 100)" ;;
|
"infobar") battery+=" $(bar "$capacity" 100)" ;;
|
||||||
|
|
Reference in New Issue