Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- export DISPLAY=:0.0
- AC_ADAPTER=$(acpi -a | cut -d' ' -f3 | cut -d- -f1)
- BATTERY_LEVEL=$(acpi -b | grep -P -o '[0-9]+(?=%)')
- while true
- do
- if [ "$AC_ADAPTER" == "on" ]; then
- if [ "$BATTERY_LEVEL" -ge 75 ]; then
- while true
- do
- notify-send -u critical "Despluge o seu adaptador!" "Bateria level: ${BATTERY_LEVEL}% (charged above 75%)" -i battery-full-charged;
- if [ "$AC_ADAPTER" == "off" ]; then
- break
- fi
- done
- fi
- else
- #check if the battery level is less than 25%
- if [ "$BATTERY_LEVEL" -lt 25 ]; then
- while true
- do
- notify-send -u critical "Plug seu AC adapter" "Level da Bateria: ${BATTERY_LEVEL}% (charge below 25%)" -i battery-caution;
- if [ "$AC_ADAPTER" == "on" ]; then
- break
- fi
- done
- fi
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement