From 1d11e75205e25dab4869205a0a05178340d24aff Mon Sep 17 00:00:00 2001 From: Léana 江 Date: Mon, 22 Jun 2026 16:42:02 +0200 Subject: guard low battery alert behind heuristics Previously low battery alerts only depend on the ac variable. The ac state that is rendered (racst) follows more heuristics. However this causes a discrepancy where xmobar can show the status is charging while continue to spawn low battery alerts. This PR fixes that by using the rendered ac state to decide whether the alert is sent. --- src/Xmobar/Plugins/Monitors/Batt/Linux.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Xmobar/Plugins/Monitors') diff --git a/src/Xmobar/Plugins/Monitors/Batt/Linux.hs b/src/Xmobar/Plugins/Monitors/Batt/Linux.hs index 5389be0..d95b902 100644 --- a/src/Xmobar/Plugins/Monitors/Batt/Linux.hs +++ b/src/Xmobar/Plugins/Monitors/Batt/Linux.hs @@ -199,5 +199,5 @@ readBatteries opts bfs = | time == 0 = Idle | ac = Charging | otherwise = Discharging - unless ac (maybeAlert opts left) + unless (racst == Charging || racst == Idle) $ maybeAlert opts left return $ if isNaN left then NA else Result left watts time racst -- cgit v1.2.3