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.

40 lines
802 B

4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
  1. #!/bin/bash
  2. if ! xdpyinfo | grep -q VNC ; then
  3. source ~/.config/config.env
  4. if [ ! "$MCONNECT" = true ] ; then
  5. exit 0
  6. fi
  7. device=$(mconnectctl | grep $MCONNECT_DEVICE | sed 's/\s\{2,\}/\n/g; s/ - /\n/g;s/^\n//g' | head -n 1)
  8. device_status=$(mconnectctl show-device $device)
  9. IFS=$'\n'
  10. lines=($device_status)
  11. IFS=": "
  12. read -ra connected <<< ${lines[8]}
  13. connected=${connected[1]}
  14. if [ ! "$connected" = true ] ; then
  15. exit 0
  16. fi
  17. battery_status=$(mconnectctl show-battery $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
  30. fi