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

#!/bin/bash
source ~/.config/config.env
if [ ! "$MCONNECT" = true ] ; then
echo "^c#EBCB8B^ ^d^"
exit 0
fi
device_status=$(mconnectctl show-device $MCONNECT_DEVICE)
IFS=$'\n'
lines=($device_status)
IFS=": "
read -ra connected <<< ${lines[8]}
connected=${connected[1]}
if [ ! "$connected" = true ] ; then
echo "^c#EBCB8B^ ^d^"
exit 0
fi
battery_status=$(mconnectctl show-battery $MCONNECT_DEVICE)
IFS=$'\n'
lines=($battery_status)
IFS=": "
read -ra level <<< ${lines[0]}
level=${level[1]}
read -ra charging <<< ${lines[1]}
charging=${charging[1]}
if [ "$charging" = 1 ] ; then
echo "^c#EBCB8B^ ^d^ $level%+"
else
echo "^c#EBCB8B^ ^d^ $level%"
fi