mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 14:03:18 -07:00
* usr/lib/byobu/battery:
- sum together all batteries
This commit is contained in:
parent
cebc2189c6
commit
6939b919c8
2 changed files with 9 additions and 9 deletions
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -1,6 +1,7 @@
|
||||||
byobu (5.95) unreleased; urgency=medium
|
byobu (5.95) unreleased; urgency=medium
|
||||||
|
|
||||||
* UNRELEASED
|
* usr/lib/byobu/battery:
|
||||||
|
- sum together all batteries
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 17 Jun 2015 20:21:41 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 17 Jun 2015 20:21:41 -0500
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ __battery_detail() {
|
||||||
__battery() {
|
__battery() {
|
||||||
local bat line present sign state percent full rem color bcolor
|
local bat line present sign state percent full rem color bcolor
|
||||||
# Linux support
|
# Linux support
|
||||||
|
present=""; full="0"; rem="0"; state=""
|
||||||
for bat in $BATTERY /sys/class/power_supply/* /proc/acpi/battery/*; do
|
for bat in $BATTERY /sys/class/power_supply/* /proc/acpi/battery/*; do
|
||||||
present=""; full=""; rem=""; state=""
|
|
||||||
case "$bat" in
|
case "$bat" in
|
||||||
/sys/*)
|
/sys/*)
|
||||||
if [ -r "$bat/uevent" ]; then
|
if [ -r "$bat/uevent" ]; then
|
||||||
|
@ -41,13 +41,12 @@ __battery() {
|
||||||
case "$POWER_SUPPLY_NAME" in AC|ac|Ac|aC) continue ;; esac
|
case "$POWER_SUPPLY_NAME" in AC|ac|Ac|aC) continue ;; esac
|
||||||
present="$POWER_SUPPLY_PRESENT"
|
present="$POWER_SUPPLY_PRESENT"
|
||||||
# Some use "CHARGE", others use "ENERGY", still others "CAPACITY"
|
# Some use "CHARGE", others use "ENERGY", still others "CAPACITY"
|
||||||
[ -n "$POWER_SUPPLY_CAPACITY" ] && rem="$POWER_SUPPLY_CAPACITY" && full="100"
|
#[ -n "$POWER_SUPPLY_CAPACITY" ] && rem="$POWER_SUPPLY_CAPACITY" && full="100"
|
||||||
[ -n "$POWER_SUPPLY_CHARGE_FULL" ] && full="$POWER_SUPPLY_CHARGE_FULL"
|
[ -n "$POWER_SUPPLY_CHARGE_FULL" ] && full=$((POWER_SUPPLY_CHARGE_FULL+full))
|
||||||
[ -n "$POWER_SUPPLY_ENERGY_FULL" ] && full="$POWER_SUPPLY_ENERGY_FULL"
|
[ -n "$POWER_SUPPLY_ENERGY_FULL" ] && full=$((POWER_SUPPLY_ENERGY_FULL+full))
|
||||||
[ -n "$POWER_SUPPLY_CHARGE_NOW" ] && rem="$POWER_SUPPLY_CHARGE_NOW"
|
[ -n "$POWER_SUPPLY_CHARGE_NOW" ] && rem=$((POWER_SUPPLY_CHARGE_NOW+rem))
|
||||||
[ -n "$POWER_SUPPLY_ENERGY_NOW" ] && rem="$POWER_SUPPLY_ENERGY_NOW"
|
[ -n "$POWER_SUPPLY_ENERGY_NOW" ] && rem=$((POWER_SUPPLY_ENERGY_NOW+rem))
|
||||||
state="$POWER_SUPPLY_STATUS"
|
[ "$POWER_SUPPLY_STATUS" != "Unknown" ] && state="$POWER_SUPPLY_STATUS"
|
||||||
[ "$present" = "1" ] && [ -n "$full" ] && [ -n "$rem" ] && [ -n "$state" ] && break
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
/proc/*)
|
/proc/*)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue