Skip to content

Commit

Permalink
* usr/lib/byobu/battery: LP: #1270451
Browse files Browse the repository at this point in the history
  - add support for yet another batter type (Android)
  - thanks to Felix Krull for the initial patch
  • Loading branch information
dustinkirkland committed Feb 28, 2014
1 parent 2ac6910 commit 4435c0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions debian/changelog
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions usr/lib/byobu/battery
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4435c0c

Please sign in to comment.