pmaports/device/community/device-nokia-n900/i3wm/scripts/battery-bq27200

15 lines
447 B
Text
Raw Normal View History

#!/bin/sh
# 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"
else
echo "#FFFFFF"
fi