mirror of
1
0
Fork 0
This commit is contained in:
jmox 2020-05-26 20:29:53 +02:00 committed by GitHub
commit 3e59cfa6db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 15 deletions

View File

@ -270,26 +270,35 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# EOF
# ;;
# *Linux*)
# while IFS= read -r batpath; do
# grep -i -q device "$batpath/scope" 2> /dev/null && continue
#
# if type "termux-battery-status" >/dev/null 2>&1; then
# if [ x"$discharging" != x"true" ]; then
# discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")
# fi
# bat_capacity="$batpath/capacity"
# if [ -r "$bat_capacity" ]; then
# charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }')
# else
# bat_energy_full="$batpath/energy_full"
# bat_energy_now="$batpath/energy_now"
# if [ -r "$bat_energy_full" ] && [ -r "$bat_energy_now" ]; then
# charge=$(awk -v charge="$charge" -v energy_now="$(cat "$bat_energy_now")" -v energy_full="$(cat "$bat_energy_full")" 'BEGIN { print charge + energy_now / energy_full }')
# fi
# discharging=$(termux-battery-status | jq -r '.status' | grep -qi "DISCHARGING" && echo "true" || echo "false")
# fi
# percentage=$(termux-battery-status | jq -r '.percentage')
# charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }')
# count=$((count + 1))
# done << EOF
# else
# 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
# bat_capacity="$batpath/capacity"
# if [ -r "$bat_capacity" ]; then
# charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }')
# else
# bat_energy_full="$batpath/energy_full"
# bat_energy_now="$batpath/energy_now"
# if [ -r "$bat_energy_full" ] && [ -r "$bat_energy_now" ]; then
# charge=$(awk -v charge="$charge" -v energy_now="$(cat "$bat_energy_now")" -v energy_full="$(cat "$bat_energy_full")" 'BEGIN { print charge + energy_now / energy_full }')
# fi
# fi
# count=$((count + 1))
# done << EOF
# $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*')
# EOF
# fi
# ;;
# *CYGWIN*|*MSYS*|*MINGW*)
# while IFS= read -r line; do