From 879b537682dcbacc1b9ce05b16a9169ddaaa8439 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 30 Nov 2019 17:36:54 +0100 Subject: [PATCH] ++battery check --- battery-check.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 battery-check.sh diff --git a/battery-check.sh b/battery-check.sh new file mode 100755 index 0000000..abe4400 --- /dev/null +++ b/battery-check.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +acpi=$(acpi) + +# Nothing to be done if we are charging +if echo "$acpi" | grep -q Charging; then + # exit 0 + : +fi + +percent=$(echo $acpi | cut -d, -f2 | sed 's/%//') + +if [ $percent -le 10 ]; then + notify-send -u critical "Battery:${percent}%" +elif [ $percent -le 15 ]; then + notify-send -u normal "Battery:${percent}%" +elif [ $percent -le 20 ]; then + notify-send -u low "Battery:${percent}%" +fi