From 01b9b433f9e4a2734deb9cc76109398824e10204 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 6 Dec 2015 11:58:29 +0100 Subject: [PATCH] use /sys/class/power_supply/BATx/capacity when available --- .tmux.conf | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index aaf7a65..7751e20 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -392,13 +392,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s apply_configuration' # if [ ! -d $batpath ]; then # batpath=/sys/class/power_supply/BAT1 # 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") -# 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 # 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") @@ -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_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 # [ x"${uname_s:0:6}" != x"CYGWIN" ] && printf "%s " 🔋 # else