Battery percentage

This commit is contained in:
2020-10-24 11:56:28 -04:00
parent 1056b9292a
commit 4b91be7b57
3 changed files with 32 additions and 26 deletions

11
scripts/get-mouse-battery.sh Executable file
View File

@ -0,0 +1,11 @@
#! /bin/bash
mouseState=$(upower -i /org/freedesktop/UPower/devices/mouse_hidpp_battery_0)
batteryPercentage=$(echo $mouseState | grep percentage | grep -Po '\d+%')
charging=$(echo $mouseState | grep 'state: charging')
if [ ! -z "$charging" ]; then
echo Charging
else
echo $batteryPercentage
fi