Skip to content

Commit

Permalink
Merge pull request #297 from NeumoNeumo/patch-1
Browse files Browse the repository at this point in the history
Fix: get status and capacity with multiple power_supplies
  • Loading branch information
ethancedwards8 authored Oct 6, 2024
2 parents 66e0910 + 25ef966 commit 5b0f4b5
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions scripts/battery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ linux_acpi() {
arg=$1
BAT=$(ls -d /sys/class/power_supply/*)
if [ ! -x "$(which acpi 2> /dev/null)" ];then
case "$arg" in
status)
cat $BAT/status
;;

percent)
cat $BAT/capacity
;;

*)
;;
esac
for DEV in $BAT; do
case "$arg" in
status)
[ -f "$DEV/status" ] && cat "$DEV/status"
;;
percent)
[ -f "$DEV/capacity" ] && cat "$DEV/capacity"
;;
*)
;;
esac
done
else
case "$arg" in
status)
Expand Down

0 comments on commit 5b0f4b5

Please sign in to comment.