mirror of
1
0
Fork 0

removed useless tests in _battery_info()

This commit is contained in:
Gregory Pakosz 2020-07-23 12:41:12 +02:00
parent a8081d87be
commit d357ae54ee
1 changed files with 4 additions and 12 deletions

View File

@ -284,9 +284,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# case "$_uname_s" in # case "$_uname_s" in
# *Darwin*) # *Darwin*)
# while IFS= read -r line; do # while IFS= read -r line; do
# if [ x"$discharging" != x"true" ]; then # discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false")
# discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false")
# fi
# percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%') # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%')
# charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }')
# count=$((count + 1)) # count=$((count + 1))
@ -298,9 +296,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# while IFS= read -r batpath; do # while IFS= read -r batpath; do
# grep -i -q device "$batpath/scope" 2> /dev/null && continue # grep -i -q device "$batpath/scope" 2> /dev/null && continue
# #
# if [ x"$discharging" != x"true" ]; then # discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")
# discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")
# fi
# bat_capacity="$batpath/capacity" # bat_capacity="$batpath/capacity"
# if [ -r "$bat_capacity" ]; then # if [ -r "$bat_capacity" ]; then
# charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }') # charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }')
@ -319,9 +315,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# *CYGWIN*|*MSYS*|*MINGW*) # *CYGWIN*|*MSYS*|*MINGW*)
# while IFS= read -r line; do # while IFS= read -r line; do
# [ -z "$line" ] && continue # [ -z "$line" ] && continue
# if [ x"$discharging" != x"true" ]; then # discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }')
# discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }')
# fi
# charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }') # charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }')
# count=$((count + 1)) # count=$((count + 1))
# done << EOF # done << EOF
@ -331,9 +325,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# *OpenBSD*) # *OpenBSD*)
# for batid in 0 1 2; do # for batid in 0 1 2; do
# sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue # sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue
# if [ x"$discharging" != x"true" ]; then # discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false")
# discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false")
# fi
# if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then # if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then
# charge=$(awk -v charge="$charge" -v remaining="$(sysctl -n hw.sensors.acpibat$batid.amphour3 | cut -d' ' -f1)" -v full="$(sysctl -n hw.sensors.acpibat$batid.amphour0 | cut -d' ' -f1)" 'BEGIN { print charge + remaining / full }') # charge=$(awk -v charge="$charge" -v remaining="$(sysctl -n hw.sensors.acpibat$batid.amphour3 | cut -d' ' -f1)" -v full="$(sysctl -n hw.sensors.acpibat$batid.amphour0 | cut -d' ' -f1)" 'BEGIN { print charge + remaining / full }')
# else # else