1
0
Fork 0
mirror of synced 2024-12-13 02:45:46 -05:00

use /sys/class/power_supply/BATx/capacity when available

This commit is contained in:
Gregory Pakosz 2015-12-06 11:58:29 +01:00
parent ea254d494f
commit 01b9b433f9

View file

@ -392,13 +392,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s apply_configuration'
# if [ ! -d $batpath ]; then # if [ ! -d $batpath ]; then
# batpath=/sys/class/power_supply/BAT1 # batpath=/sys/class/power_supply/BAT1
# fi # fi
# batfull=$batpath/energy_full
# batnow=$batpath/energy_now
# if [ ! -r $batfull -o ! -r $batnow ]; then
# return
# fi
# discharging=$(grep -qi "discharging" $batpath/status && echo "true" || echo "false") # discharging=$(grep -qi "discharging" $batpath/status && echo "true" || echo "false")
# charge="$(cat $batnow) / $(cat $batfull)" || return # bat_capacity=$batpath/capacity
# bat_energy_full=$batpath/energy_full
# bat_energy_now=$batpath/energy_now
# if [ -r "$bat_capacity" ] ; then
# charge="$(cat $bat_capacity) / 100"
# else
# if [ ! -r "$bat_energy_full" -o ! -r "$bat_energy_now" ]; then
# return
# fi
# charge="$(cat $bat_energy_now) / $(cat $bat_energy_full)" || return
# fi
# elif [ x"${uname_s:0:6}" = x"CYGWIN" ]; then # elif [ x"${uname_s:0:6}" = x"CYGWIN" ]; then
# wmic path Win32_Battery 2>&1 | grep -q 'No Instance' && return # wmic path Win32_Battery 2>&1 | grep -q 'No Instance' && return
# discharging=$(wmic path Win32_Battery Get BatteryStatus 2>/dev/null | grep -q 1 && echo "true" || echo "false") # discharging=$(wmic path Win32_Battery Get BatteryStatus 2>/dev/null | grep -q 1 && echo "true" || echo "false")
@ -427,7 +432,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s apply_configuration'
# eval battery_symbol_full='$battery_symbol_'"$battery_symbol"'_full' # eval battery_symbol_full='$battery_symbol_'"$battery_symbol"'_full'
# eval battery_symbol_empty='$battery_symbol_'"$battery_symbol"'_empty' # eval battery_symbol_empty='$battery_symbol_'"$battery_symbol"'_empty'
# #
# if [ x"$battery_status" = x"1"] || [ x"$battery_status" = x"true" ] || [ x"$battery_status" = x"enabled" ] ; then # if [ x"$battery_status" = x"1" ] || [ x"$battery_status" = x"true" ] || [ x"$battery_status" = x"enabled" ] ; then
# if [ x"$discharging" = x"true" ]; then # if [ x"$discharging" = x"true" ]; then
# [ x"${uname_s:0:6}" != x"CYGWIN" ] && printf "%s " 🔋 # [ x"${uname_s:0:6}" != x"CYGWIN" ] && printf "%s " 🔋
# else # else