mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 14:24:39 -07:00
* usr/lib/byobu/battery:
- fix battery status caching issues when battery is full, or plugged into AC
This commit is contained in:
parent
2786a91115
commit
b61704d4a7
2 changed files with 9 additions and 3 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -1,6 +1,8 @@
|
|||
byobu (5.56) unreleased; urgency=low
|
||||
|
||||
* UNRELEASED
|
||||
* usr/lib/byobu/battery:
|
||||
- fix battery status caching issues when battery is full, or
|
||||
plugged into AC
|
||||
|
||||
-- Dustin Kirkland <kirkland@ubuntu.com> Sat, 10 Aug 2013 09:23:04 +0100
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ __battery() {
|
|||
/sys/*)
|
||||
if [ -r "$bat/uevent" ]; then
|
||||
. "$bat/uevent"
|
||||
[ "$POWER_SUPPLY_NAME" = "AC" ] && continue
|
||||
present="$POWER_SUPPLY_PRESENT"
|
||||
# Some use "CHARGE", others use "ENERGY"
|
||||
[ -n "$POWER_SUPPLY_CHARGE_FULL" ] && full="$POWER_SUPPLY_CHARGE_FULL"
|
||||
|
@ -84,14 +85,17 @@ __battery() {
|
|||
color="G k"
|
||||
bcolor="b G k"
|
||||
fi
|
||||
percent="$percent$PCT"
|
||||
percent="${percent}${PCT}"
|
||||
case $state in
|
||||
charging|Charging|Unknown) sign="+" ;;
|
||||
discharging|Discharging) sign="-" ;;
|
||||
charged|Unknown|Full) sign="="; percent="" ;;
|
||||
*) sign="$state" ;;
|
||||
esac
|
||||
[ -n "$percent" ] || return
|
||||
if [ -z "$percent" ]; then
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/battery"*
|
||||
return
|
||||
fi
|
||||
color $bcolor; printf "%s" "$percent"; color -; color $color; printf "%s" "$sign"; color --
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue