Another copy of my dotfiles. Because I don't completely trust GitHub.
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.

39 lines
679 B

4 years ago
4 years ago
  1. #!/bin/bash
  2. source ~/.config/config.env
  3. if [ ! "$MCONNECT" = true ] ; then
  4. echo "^c#EBCB8B^ ^d^"
  5. exit 0
  6. fi
  7. device_status=$(mconnectctl show-device $MCONNECT_DEVICE)
  8. IFS=$'\n'
  9. lines=($device_status)
  10. IFS=": "
  11. read -ra connected <<< ${lines[8]}
  12. connected=${connected[1]}
  13. if [ ! "$connected" = true ] ; then
  14. echo "^c#EBCB8B^ ^d^"
  15. exit 0
  16. fi
  17. battery_status=$(mconnectctl show-battery $MCONNECT_DEVICE)
  18. IFS=$'\n'
  19. lines=($battery_status)
  20. IFS=": "
  21. read -ra level <<< ${lines[0]}
  22. level=${level[1]}
  23. read -ra charging <<< ${lines[1]}
  24. charging=${charging[1]}
  25. if [ "$charging" = 1 ] ; then
  26. echo "^c#EBCB8B^ ^d^ $level%+"
  27. else
  28. echo "^c#EBCB8B^ ^d^ $level%"
  29. fi