diff --git a/scripts/battery-monitor.sh b/scripts/battery-monitor.sh
index c642220..11dd259 100755
--- a/scripts/battery-monitor.sh
+++ b/scripts/battery-monitor.sh
@@ -1,11 +1,9 @@
#!/bin/bash
-# Battery Monitor - Fixed and Optimized
UP_THRESHOLD=90
DOWN_THRESHOLD=20
CHECK_INTERVAL=0.3
-# Find battery path (more reliable method)
BATTERY_PATH=$(find /sys/class/power_supply/ -name "BAT*" | head -1)
AC_PATH=$(find /sys/class/power_supply/ -name "AC*" | head -1)
[ -z "$BATTERY_PATH" ] && echo "No battery found" && exit 1
@@ -17,19 +15,15 @@ while true; do
level=<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mo stretchy="false">(</mo><mi>c</mi><mi>a</mi><mi>t</mi><mi>"</mi></mrow></math>BATTERY_PATH/capacity")
ac_status=<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mo stretchy="false">(</mo><mi>c</mi><mi>a</mi><mi>t</mi><mi>"</mi></mrow></math>AC_PATH/online" 2>/dev/null || echo "0")
- # 1. Plug detection (AC status changed from 0 to 1)
if [ "<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>a</mi><msub><mi>c</mi><mi>s</mi></msub><mi>t</mi><mi>a</mi><mi>t</mi><mi>u</mi><mi>s</mi><mi>"</mi><mo>−</mo><mi>e</mi><mi>q</mi><mn>1</mn><mo stretchy="false">]</mo><mi>&</mi><mi>&</mi><mo stretchy="false">[</mo><mi>"</mi></mrow></math>last_ac_status" -eq 0 ]; then
pino -t "Plugged In" -m "Now charging ($level%)" -d 5
-
- # 2. Unplug detection (AC status changed from 1 to 0)
+
elif [ "<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>a</mi><msub><mi>c</mi><mi>s</mi></msub><mi>t</mi><mi>a</mi><mi>t</mi><mi>u</mi><mi>s</mi><mi>"</mi><mo>−</mo><mi>e</mi><mi>q</mi><mn>0</mn><mo stretchy="false">]</mo><mi>&</mi><mi>&</mi><mo stretchy="false">[</mo><mi>"</mi></mrow></math>last_ac_status" -eq 1 ]; then
pino -t "Unplugged" -m "On battery ($level%)" -d 5
- # 3. Crossed above 90% (only when discharging)
elif [ "<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>l</mi><mi>e</mi><mi>v</mi><mi>e</mi><mi>l</mi><mi>"</mi><mo>−</mo><mi>g</mi><mi>e</mi></mrow></math>UP_THRESHOLD ] && [ "<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>l</mi><mi>a</mi><mi>s</mi><msub><mi>t</mi><mi>l</mi></msub><mi>e</mi><mi>v</mi><mi>e</mi><mi>l</mi><mi>"</mi><mo>−</mo><mi>l</mi><mi>t</mi></mrow></math>UP_THRESHOLD ] && [ "$ac_status" -eq 0 ]; then
pino -t "Battery High" -m "Reached $level%" -d 5
- # 4. Crossed below 20% (only when discharging)
elif [ "<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>l</mi><mi>e</mi><mi>v</mi><mi>e</mi><mi>l</mi><mi>"</mi><mo>−</mo><mi>l</mi><mi>e</mi></mrow></math>DOWN_THRESHOLD ] && [ "<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>l</mi><mi>a</mi><mi>s</mi><msub><mi>t</mi><mi>l</mi></msub><mi>e</mi><mi>v</mi><mi>e</mi><mi>l</mi><mi>"</mi><mo>−</mo><mi>g</mi><mi>t</mi></mrow></math>DOWN_THRESHOLD ] && [ "$ac_status" -eq 0 ]; then
pino -t "Battery Low" -m "Only $level% left" -d 5
fi