Apple - adjust battery-warning-level of magic mouse

This thread has some scripts that can help you.

It seems that you wrap the results of this shell snippet in a nice AppleScript:

ioreg -c BNBMouseDevice | grep BatteryPercent

In my macOS Sierra 10.12.6, there is no BNBMouseDevice. Script which works for me is:

ioreg -c AppleDeviceManagementHIDEventService -r -l | grep BatteryPercent | sed 's/[^[:digit:]]//g'

Source: Check the battery level of connected bluetooth headphones from the command line