summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLéana 江 <leana.jiang+git@icloud.com>2026-06-22 16:42:02 +0200
committerLéana 江 <leana.jiang+git@icloud.com>2026-06-22 16:42:02 +0200
commit1d11e75205e25dab4869205a0a05178340d24aff (patch)
treebaa431aae38402b4106e7b89eba3282c4d19e2f9
parent139bfaf7f00d1fa51a2053c5c82e7f420b75778e (diff)
downloadxmobar-1d11e75205e25dab4869205a0a05178340d24aff.tar.gz
xmobar-1d11e75205e25dab4869205a0a05178340d24aff.tar.bz2
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.
-rw-r--r--src/Xmobar/Plugins/Monitors/Batt/Linux.hs2
1 files changed, 1 insertions, 1 deletions
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