unix-config/.config/scripts/util/mouse-battery.sh

20 lines
453 B
Bash
Executable File

#!/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