From 8d8da3e74cf482712f98eee321d30f5bc0f141c1 Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Wed, 8 Jan 2020 19:44:49 +0530 Subject: FreeBSD battery: Condition to notify if battery is full. --- src/Xmobar/Plugins/Monitors/Batt.hs | 5 +++-- 1 file 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) -- cgit v1.2.3