commit 4d61a485a38f954948edde6b70b4e6888bb38747 Author: Emil Miler Date: Tue Dec 8 10:01:20 2020 +0100 Initial commit diff --git a/batterycheck b/batterycheck new file mode 100755 index 0000000..ae34ee5 --- /dev/null +++ b/batterycheck @@ -0,0 +1,12 @@ +#!/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%" +