aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2011-11-19 02:20:08 +0100
committerAdrian C. (anrxc) <anrxc@sysphere.org>2011-11-19 02:20:08 +0100
commit350e9240ea792446efb22564060384f535ac4e34 (patch)
tree667df572e799c557662c8562b572077f21d27aa4 /widgets
parenteeb27a29166ba30d84a4044fd7ce1acbfa93cadc (diff)
downloadvicious-legacy-350e9240ea792446efb22564060384f535ac4e34.tar.xz
bat: another workaround for broken ACPI implementations
Diffstat (limited to 'widgets')
-rw-r--r--widgets/bat.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/widgets/bat.lua b/widgets/bat.lua
index 615f9dd..2f93518 100644
--- a/widgets/bat.lua
+++ b/widgets/bat.lua
@@ -73,8 +73,9 @@ local function worker(format, warg)
else
return {state, percent, time}
end
- local hoursleft = math.floor(timeleft)
- local minutesleft = math.floor((timeleft - hoursleft) * 60 )
+ -- Calculate time (but work around broken BAT/ACPI implementations)
+ local hoursleft = math.min(math.floor(timeleft), 0)
+ local minutesleft = math.min(math.floor((timeleft - hoursleft) * 60 ), 0)
time = string.format("%02d:%02d", hoursleft, minutesleft)
end