You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
317 B

  1. #!/bin/bash
  2. READBAT="cat /sys/class/power_supply/axp20x-battery/uevent"
  3. GETVAL="cut -d= -f2"
  4. LOWERCASE="tr '[:upper:]' '[:lower:]'"
  5. STATUS=`$READBAT | grep STATUS | $GETVAL | $LOWERCASE`
  6. CHARGE=`$READBAT | grep CAPACITY | $GETVAL`
  7. TEXT="$CHARGE%"
  8. CLASS=$STATUS
  9. echo {\"text\": \"$TEXT\", \"class\": \"$CLASS\"}