diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-11-10 16:10:20 +0100 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-11-10 16:10:20 +0100 |
commit | 6fadee6fb577075a6e848fd2b5cdd60417adef6c (patch) | |
tree | 3613d188400aaa1ab3704823b892e1514e5f9dcf | |
parent | 8e21d264d2bf1b420986eab364be155f85a4e0d0 (diff) | |
download | vicious-legacy-6fadee6fb577075a6e848fd2b5cdd60417adef6c.tar.xz |
batsys: don't return 0 if only rate is missing
-rw-r--r-- | batsys.lua | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -57,14 +57,14 @@ local function worker(format, batid) return {battery_state["Unknown\n"], 0, "N/A"} end - -- Get charge information - if battery.current_now then rate = battery.current_now - else return {battery_state["Unknown\n"], 0, "N/A"} end - - -- Calculate percentage (but work around broken BAT/ACPI implementations) local percent = math.min(math.floor(remaining / capacity * 100), 100) + + -- Get charge information + if battery.current_now then rate = battery.current_now + else return {state, percent, "N/A"} end + -- Calculate remaining (charging or discharging) time if state == "+"then timeleft = (tonumber(capacity) - tonumber(remaining)) / tonumber(rate) |