This repository has been archived on 2025-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
inks-scripts/scripts/status-bat

43 lines
556 B
Bash
Executable File

#!/bin/bash
icon=""
current=$(acpi --battery | sed -e 's/%.*//' | sed 's/.*, //')
status="$current%"
state=$(acpi --battery | sed -e 's/,.*//' | sed 's/.*: //')
if [[ "$state" == "Discharging" ]]; then
case $((current/20)) in
1)
icon=""
;;
2)
icon=""
;;
3)
icon=""
;;
4)
icon=""
;;
5)
icon=""
;;
esac
fi
if [[ "$state" == "Not charging" ]]; then
icon=""
fi
if [[ "$state" == "Full" ]]; then
icon=""
status="Full"
fi
if [[ "$state" == "Charging" ]]; then
icon=""
fi
echo "$icon $status"