#!/bin/sh
# shellcode disable=2034
coded_by='

In the name of Allah, the most Gracious, the most Merciful.

 ▓▓▓▓▓▓▓▓▓▓
░▓ Author ▓ Abdullah <https://abdullah.today>
░▓▓▓▓▓▓▓▓▓▓ YouTube <https://YouTube.com/AbdullahToday>
░░░░░░░░░░

░█▀▄░█▀█░▀█▀░▀█▀░█▀▀░█▀▄░█░█
░█▀▄░█▀█░░█░░░█░░█▀▀░█▀▄░░█░
░▀▀░░▀░▀░░▀░░░▀░░▀▀▀░▀░▀░░▀░
'


# If battery is low, push a notification

battery_status=$(cat /sys/class/power_supply/BAT0/capacity)
is_charger_connected=$(cat /sys/class/power_supply/AC/online)


while true; do
  if [ "$battery_status" -le 30 ] && [ "$is_charger_connected" -eq 0 ]; then
    notify-send -u critical "Battery critically low"
  fi
  sleep 60
done
