I need to enable power (AC) failure (off-line) and power on (on-line) notifications, like this notification:
I searched and tried to do that, but I didn't find any successful articles. I use these commands to monitor my AC adapter:
acpi- a echo ac_adapter=$(acpi -a | cut -d' ' -f3 | cut -d- -f1)
But I don't know how to write notification on code.
Can I write a shell script like the following?
#!/bin/bash power=ac_adapter=$(acpi -a | cut -d' ' -f3 | cut -d- -f1) s1="$power" if [ "$s1" = "off-line" ]; then notify-send --urgency=low "Power Manager" "Power Down" -i battery_low echo "notification: off" >~/.scripts/notification else if [ $s1 = "on-line" ]; then notify-send --urgency=normal "Power Manager" "Power Up" -i battery_full fi fi