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