Update: Changed scipts, updated readme.

This commit is contained in:
Keyitdev
2022-06-22 19:27:20 +02:00
parent 35c6ea42ec
commit c589d31ace
11 changed files with 208 additions and 163 deletions
+15 -15
View File
@@ -1,35 +1,35 @@
#!/bin/bash
#!/bin/sh
for pid in $(pidof -x battery); do
if [ $pid != $$ ]; then
kill -9 $pid
if [ "$pid" != $$ ]; then
kill -9 "$pid"
fi
done
DIR_ICONS="/usr/local/bin/icons"
dir_icons="/usr/local/bin/icons"
# Notify when below this percentage
WARNING_LEVEL=15
# notify when below this percentage
warning_level=15
# How often to check battery status, in minutes
CHECK_INTERVAL=1
# how often to check battery status, in minutes
check_interval=1
while true; do
battery_level=$(acpi -b \
| cut -d, -f2 | cut --characters=2,3,4 \
| sed 's/%//g')
charging=$(acpi -b | grep -c "Charging")
charging=$(acpi -b | grep -c "charging")
# When battery is low, and not already charging
if [ $battery_level -lt $WARNING_LEVEL ] &&
[ $charging -eq 0 ]
# when battery is low, and not already charging
if [ "$battery_level" -lt "$warning_level" ] &&
[ "$charging" -eq 0 ]
then
dunstify -a "Battery" \
"Low battery: ${battery_level}%" \
"Battery is running low" \
-r 100 \
-i $DIR_ICONS/battery.svg
-i $dir_icons/battery.svg
fi
sleep ${CHECK_INTERVAL}m
done
sleep ${check_interval}m
done