2022-12-12 15:59:27 +01:00
|
|
|
#!/bin/bash
|
2022-11-09 20:00:41 +01:00
|
|
|
|
|
|
|
prct=$(upower -d | grep percentage | sed -n "1p" | sed -e 's/^.* //')
|
|
|
|
prctonly=$(upower -d | grep percentage | sed -n "1p" | sed -e 's/^.* //' | sed 's/%//')
|
|
|
|
stat=$(upower -d | grep -m1 state | sed -e 's/^.* //')
|
|
|
|
|
|
|
|
## if any argument
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
if [[ $stat == "charging" ]]; then
|
2022-12-12 15:59:27 +01:00
|
|
|
echo "BAT $prct +"
|
2022-11-09 20:00:41 +01:00
|
|
|
exit
|
|
|
|
fi
|
2022-12-12 15:59:27 +01:00
|
|
|
echo "BAT $prct -"
|
2022-11-09 20:00:41 +01:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2022-11-09 21:37:11 +01:00
|
|
|
echo $prct
|