* usr/lib/byobu/battery: LP: #1270451

- add support for yet another batter type (Android)
  - thanks to Felix Krull for the initial patch
This commit is contained in:
Dustin Kirkland 2014-02-28 17:18:36 -06:00
commit 4435c0c443
2 changed files with 11 additions and 5 deletions

3
debian/changelog vendored
View file

@ -6,6 +6,9 @@ byobu (5.74) unreleased; urgency=low
https://github.com/erans/ec2instancespricing
* usr/share/byobu/profiles/tmux: LP: #1273685
- remove double sourcing of local .tmux.conf
* usr/lib/byobu/battery: LP: #1270451
- add support for yet another batter type (Android)
- thanks to Felix Krull for the initial patch
[ Arminius Silvanus ]
* usr/share/byobu/profiles/bashrc: LP: #1280550

View file

@ -37,9 +37,10 @@ __battery() {
/sys/*)
if [ -r "$bat/uevent" ]; then
. "$bat/uevent"
[ "$POWER_SUPPLY_NAME" = "AC" ] && continue
case "$POWER_SUPPLY_NAME" in AC|ac|Ac|aC) continue ;; esac
present="$POWER_SUPPLY_PRESENT"
# Some use "CHARGE", others use "ENERGY"
# Some use "CHARGE", others use "ENERGY", still others "CAPACITY"
[ -n "$POWER_SUPPLY_CAPACITY" ] && rem="$POWER_SUPPLY_CAPACITY" && full="100"
[ -n "$POWER_SUPPLY_CHARGE_FULL" ] && full="$POWER_SUPPLY_CHARGE_FULL"
[ -n "$POWER_SUPPLY_ENERGY_FULL" ] && full="$POWER_SUPPLY_ENERGY_FULL"
[ -n "$POWER_SUPPLY_CHARGE_NOW" ] && rem="$POWER_SUPPLY_CHARGE_NOW"
@ -86,10 +87,12 @@ __battery() {
bcolor="b G k"
fi
percent="${percent}${PCT}"
# Convert state to lower case
state=$(printf "%s" "$state" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
case $state in
charging|Charging|Unknown) sign="+" ;;
discharging|Discharging) sign="-" ;;
charged|Unknown|Full) sign="="; percent="" ;;
charging) sign="+" ;;
discharging) sign="-" ;;
charged|unknown|full) sign="=" ;;
*) sign="$state" ;;
esac
if [ -z "$percent" ]; then