2019-07-20 21:30:08 +00:00
|
|
|
#!/bin/sh
|
2023-09-11 13:45:36 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
upower_batt="/org/freedesktop/UPower/devices/battery_bq27200_0"
|
|
|
|
upower_data=$(upower -i "$upower_batt" 2> /dev/null)
|
|
|
|
capacity=$(echo "$upower_data" | awk '/percentage/ {print $NF}')
|
|
|
|
state=$(echo "$upower_data" | awk '/state/ {print $NF}')
|
|
|
|
echo "$capacity"
|
|
|
|
echo "$capacity"
|
|
|
|
|
|
|
|
if [ "$state" = "charging" ] || [ "$state" = "fully-charged" ]; then
|
|
|
|
echo "#0099FF"
|
2019-07-20 21:30:08 +00:00
|
|
|
else
|
2023-09-11 13:45:36 +00:00
|
|
|
echo "#FFFFFF"
|
2019-07-20 21:30:08 +00:00
|
|
|
fi
|