summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Xmobar/Plugins/Monitors/Batt.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Batt.hs b/src/Xmobar/Plugins/Monitors/Batt.hs
index 0181f83..4ea7591 100644
--- a/src/Xmobar/Plugins/Monitors/Batt.hs
+++ b/src/Xmobar/Plugins/Monitors/Batt.hs
@@ -175,11 +175,12 @@ readBatteriesFbsd opts = do
tm <- sysctlReadInt "hw.acpi.battery.time"
st <- sysctlReadInt "hw.acpi.battery.state"
acline <- sysctlReadInt "hw.acpi.acline"
- let sts = battStatusFbsd $ fromIntegral st
- p = fromIntegral lf / 100
+ let p = fromIntegral lf / 100
w = fromIntegral rt
t = fromIntegral tm * 60
ac = acline == 1
+ -- battery full when rate is 0 and on ac.
+ sts = if (w == 0 && ac) then Full else (battStatusFbsd $ fromIntegral st)
unless ac (maybeAlert opts p)
return (Result p w t sts)