Quantcast
Channel: How can I get notification when my laptop battery gets fully charged? - Ask Ubuntu
Viewing all articles
Browse latest Browse all 5

Answer by Devarshi Sathiya for How can I get notification when my laptop battery gets fully charged?

$
0
0

Here is the Crontab that I use

  1. Notify if battery is full (equal to 100%)

    */1 * * * * if [ $(cat /sys/class/power_supply/BAT0/capacity) -eq 100 ]; then XDG_RUNTIME_DIR=/run/user/$(id -u) notify-send Hey "Battery Full"; fi
  2. Notify if battery is low (less than or equal to 10%)

    */1 * * * * if [ $(cat /sys/class/power_supply/BAT0/capacity) -le 10 ]; then XDG_RUNTIME_DIR=/run/user/$(id -u) notify-send Hey "Battery Low"; fi

Example Notification Image:

Example Notification Image


Viewing all articles
Browse latest Browse all 5

Trending Articles