mirror of
1
0
Fork 0
This commit is contained in:
gponick 2017-06-16 00:39:38 +00:00 committed by GitHub
commit 7b1fcf518a
1 changed files with 22 additions and 13 deletions

View File

@ -235,6 +235,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# #
# _battery() { # _battery() {
# uname_s=$(uname -s) # uname_s=$(uname -s)
# uname_a=$(uname -a)
# case "$uname_s" in # case "$uname_s" in
# *Darwin*) # *Darwin*)
# batt=$(pmset -g batt) # batt=$(pmset -g batt)
@ -243,21 +244,29 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# charge="${percentage%%%} / 100" # charge="${percentage%%%} / 100"
# ;; # ;;
# *Linux*) # *Linux*)
# batpath=/sys/class/power_supply/BAT0 # if echo $uname_a | grep -q "Microsoft"; then
# if [ ! -d $batpath ]; then # # Bash on ubuntu on windows
# batpath=/sys/class/power_supply/BAT1 # discharging=$(powershell.exe "(Get-WmiObject win32_battery).BatteryStatus" | grep -q 1 && echo "true" || echo "false")
# fi # percentage=$(powershell.exe "(Get-WmiObject win32_battery).estimatedChargeRemaining")
# discharging=$(grep -qi "discharging" $batpath/status && echo "true" || echo "false") # charge="${percentage} / 100"
# 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 # else
# if [ ! -r "$bat_energy_full" ] || [ ! -r "$bat_energy_now" ]; then # # Linux
# return # batpath=/sys/class/power_supply/BAT0
# if [ ! -d $batpath ]; then
# batpath=/sys/class/power_supply/BAT1
# fi
# discharging=$(grep -qi "discharging" $batpath/status && echo "true" || echo "false")
# 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" ] || [ ! -r "$bat_energy_now" ]; then
# return
# fi
# charge="$(cat $bat_energy_now) / $(cat $bat_energy_full)" || return
# fi # fi
# charge="$(cat $bat_energy_now) / $(cat $bat_energy_full)" || return
# fi # fi
# ;; # ;;
# *CYGWIN*) # *CYGWIN*)