Browse Source

add battery-status, runs very very slow

pull/1/head
10sr 12 years ago
parent
commit
6ee19f82f8
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      bashrc

+ 11
- 0
bashrc View File

@@ -376,3 +376,14 @@ winln(){
fi
}

battery-status(){
local dir=/sys/class/power_supply/BAT0
st=$(cat $dir/status)
full=$(cat $dir/charge_full)
now=$(cat $dir/charge_now)
# . $dir/uevent
# rate=$(expr $POWER_SUPPLY_CHARGE_NOW \* 100 / $POWER_SUPPLY_CHARGE_FULL)
rate=$(expr $now \* 100 / $full)
echo ${st}:${rate}\%
}


Loading…
Cancel
Save