Added script for mouse battery levels

This commit is contained in:
pfych 2024-09-15 13:57:28 +10:00
parent f91f63ddde
commit a59c6f6afb

View File

@ -0,0 +1,19 @@
#!/bin/sh
DETAILS=$(rivalcfg --battery-level)
STATUS=$(echo $DETAILS | cut -d' ' -f1)
LEVEL=$(echo $DETAILS | cut -d']' -f2 | tr -d '[:space:]')
if [ "$STATUS" != 'Discharging' ] && [ "$STATUS" != 'Charging' ]; then
cat /tmp/last-mouse-level.txt
else
if [ $STATUS == 'Discharging' ]; then
STATUS_EMOJI='🐁'
else
STATUS_EMOJI='⚡'
fi
echo "| $STATUS_EMOJI $LEVEL |" > /tmp/last-mouse-level.txt
cat /tmp/last-mouse-level.txt
fi