low_battery.sh 556 B

123456789101112
  1. #!/bin/bash
  2. # Check AC adapter status and Battery Voltage
  3. if [ $(cat /sys/class/power_supply/AC/online) = "0" ] && \
  4. [ $(cat /sys/class/power_supply/BAT0/capacity) -le 10 ]; then
  5. # Display Notification
  6. if [ $DISPLAY ]; then
  7. notify-send -u critical \
  8. -i /usr/share/icons/breeze/status/symbolic/battery-low-symbolic.svg \
  9. "Battery Critically Low" "Plug in to AC or Suspend immediately"; fi
  10. # Play Alert Sound
  11. # for play_beep in {1..4}; do $(aplay /home/b00m/Downloads/beep-08b.wav > /dev/null 2>&1); done
  12. fi