From d357ae54ee02f750e4d0687dd3f9e843fd047a99 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 23 Jul 2020 12:41:12 +0200 Subject: [PATCH] removed useless tests in _battery_info() --- .tmux.conf | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 8edd999..8f07d47 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -284,9 +284,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # case "$_uname_s" in # *Darwin*) # while IFS= read -r line; do -# if [ x"$discharging" != x"true" ]; then -# discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") -# fi +# discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%') # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') # count=$((count + 1)) @@ -298,9 +296,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # while IFS= read -r batpath; do # 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") -# fi +# discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false") # bat_capacity="$batpath/capacity" # if [ -r "$bat_capacity" ]; then # 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*) # while IFS= read -r line; do # [ -z "$line" ] && continue -# if [ x"$discharging" != x"true" ]; then -# discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }') -# fi +# discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }') # charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }') # count=$((count + 1)) # done << EOF @@ -331,9 +325,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # *OpenBSD*) # for batid in 0 1 2; do # 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") -# fi +# discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false") # 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 }') # else