18 lines
377 B
Plaintext
18 lines
377 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
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
|
||
|
echo "BAT $prct +"
|
||
|
exit
|
||
|
fi
|
||
|
echo "BAT $prct -"
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
echo $prct
|