You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
341 B
Bash
14 lines
341 B
Bash
#!/bin/sh -e
|
|
|
|
limit=${1:-18}
|
|
acpi=$(acpi -b)
|
|
acpi_status=$(echo "$acpi" | awk -F ': |,' {'print $2'})
|
|
|
|
[ "$acpi_status" == "Discharging" ] &&
|
|
acpi_value=$(echo "$acpi" | awk -F ", " {'print $2'} | sed 's/%//') &&
|
|
[ "$acpi_value" -lt "$limit" ] &&
|
|
export DISPLAY=:0.0 &&
|
|
notify-send -u critical "Battery charge at $acpi_value%"
|
|
exit 0
|
|
|