Updated the battery status script.

This commit is contained in:
stormdragon2976 2022-11-30 17:47:37 -05:00
parent bd88e966de
commit f87f2e4268

View File

@ -1,10 +1,13 @@
#!/bin/env bash
#Get battery status
cd /sys/class/power_supply
for f in `ls`; do
if [ -e $f"/capacity" ]; then
export stat=`cat $f"/status"`
export cap=`cat $f"/capacity"`
echo battery $f": "$stat", "$cap"%"
#!/usr/bin/env bash
find /sys/class/power_supply -type l -exec bash -c '
for i ; do
if [[ -e "$i/capacity" ]]; then
bat="${i##*/}"
bat="${bat//BAT/Battery }"
bat="${bat}: $(cat "${i}/capacity") percent"
spd-say -P important -Cw "$bat"
fi
done|spd-say -e
done
' _ {} \;