16 lines
383 B
Bash
Executable File
16 lines
383 B
Bash
Executable File
#!/bin/bash
|
|
|
|
praznim=$(acpi -b | grep Discharging)
|
|
lvl=$(acpi -b | sed -e 's/[,%\s]//g' | awk '{s+=$4} END {printf "%.0f", s/2}')
|
|
|
|
nizka=7
|
|
kriticna=3
|
|
|
|
if [[ $praznim ]]; then
|
|
if [[ $lvl -lt $kriticna ]]; then
|
|
systemctl suspend
|
|
elif [[ $lvl -lt $nizka ]]; then
|
|
notify-send -u critical -i /usr/share/icons/gnome/32x32/status/battery-low.png "BATERIJA NISKA: $lvl%"
|
|
fi
|
|
fi
|