mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 22:13:19 -07:00
* usr/lib/byobu/battery: LP: #1289157
- Mac OS X battery indicator support
This commit is contained in:
parent
678e6348d2
commit
f20b760644
2 changed files with 30 additions and 0 deletions
5
debian/changelog
vendored
5
debian/changelog
vendored
|
@ -1,5 +1,6 @@
|
|||
byobu (5.75) unreleased; urgency=medium
|
||||
|
||||
[ Dustin Kirkland ]
|
||||
* debian/control:
|
||||
- bump standards
|
||||
* usr/lib/byobu/include/shutil, usr/lib/byobu/release: LP: #1278016
|
||||
|
@ -19,6 +20,10 @@ byobu (5.75) unreleased; urgency=medium
|
|||
- allow byobu-launch to pass arguments through to byobu-launcher
|
||||
- fix up the uninstallation of byobu launcher
|
||||
|
||||
[ Kosuke Asami ]
|
||||
* usr/lib/byobu/battery: LP: #1289157
|
||||
- Mac OS X battery indicator support
|
||||
|
||||
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 16 Mar 2014 12:46:36 -0700
|
||||
|
||||
byobu (5.74-0ubuntu1) trusty; urgency=low
|
||||
|
|
|
@ -31,6 +31,7 @@ __battery_detail() {
|
|||
|
||||
__battery() {
|
||||
local bat line present sign state percent full rem color bcolor
|
||||
# Linux support
|
||||
for bat in $BATTERY /sys/class/power_supply/* /proc/acpi/battery/*; do
|
||||
present=""; full=""; rem=""; state=""
|
||||
case "$bat" in
|
||||
|
@ -74,6 +75,30 @@ __battery() {
|
|||
;;
|
||||
esac
|
||||
done
|
||||
# Mac OS X support
|
||||
if $BYOBU_TEST /usr/sbin/ioreg >/dev/null 2>&1; then
|
||||
# MacOS support
|
||||
local key
|
||||
for key in CurrentCapacity MaxCapacity ExternalChargeCapable FullyCharged; do
|
||||
line=$(/usr/sbin/ioreg -n AppleSmartBattery -w0 | grep $key | sed -e 's/|//g' | awk '{ print $3 }')
|
||||
case "$key" in
|
||||
CurrentCapacity) rem="$line";;
|
||||
MaxCapacity) full="$line";;
|
||||
ExternalChargeCapable)
|
||||
if [ "${line}" = "Yes" ]; then
|
||||
state="charging"
|
||||
elif [ "${line}" = "No" ]; then
|
||||
state="discharging"
|
||||
fi
|
||||
;;
|
||||
FullyCharged)
|
||||
if [ "${line}" = "Yes" ]; then
|
||||
state="charged"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ $rem -ge 0 ] && [ $full -gt 0 ]; then
|
||||
percent=$(((100*$rem)/$full))
|
||||
if [ "$percent" -lt 33 ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue