bin/battery @ 73ac57eeaeea
default tip
Merge
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 29 Aug 2025 14:55:22 -0400 |
parents |
2e41ef790dc8 |
children |
(none) |
#!/usr/bin/env bash
set -euo pipefail
function check_battery {
# TODO make this less shit
BATT="$1"
echo "$BATT"
cat "$BATT"/type
if test -e "$BATT"/online; then
echo -n "Online: "
cat "$BATT"/online
fi
if test -e "$BATT"/capacity; then
echo -n "Capacity (%): "
cat "$BATT"/capacity
fi
echo
}
for b in /sys/class/power_supply/*; do
check_battery "$b"
done