#!/bin/bash
state=$(acpi -a)
# echo "$state"
if [[ "$state" = "Adapter 0: on-line" ]]
then
echo "Charging"
exit 0
fi
bat=$(acpi -b | sed 's#.*charging, ##;s#%.*##')
echo "$bat %"
if [[ "$bat" = 100 ]]
echo "Full"
if [[ "$bat" -lt 20 ]]
echo "Suspending"
systemctl suspend