Every once in a while the rechargeable batteries of my keyboard or trackpad would be drained in the morning, right the moment when I needed them most. Of course there is the warning from the OS that I should check the battery, but that doesn’t fit my workflow: I keep forgetting the warning, or act on it when I should be doing more important stuff. I am a procrastinator: I would instantly hunt around the house for new batteries whenever Mac OS X warned me about battery levels.
So I procrastinated in a more productive way, and implemented a script that does the check at regular intervals and sends me an e-mail. I stick to INBOX zero combined with Tickler mail folders, so when the mail comes in I either respond to it, or drop it in the @This Evening mail folder, to postpone the action till a later time.
You can download BTBattCheck.pl and store it somewhere in your home directory, for example $HOME/bin/. You can then run it periodically using cron or use launchd . The crontab below will run the script every hour:
10 17-20 * * * $HOME/bin/BTBattCheck.pl | mail -E -s 'Battery low' firstname.lastname@example.org
Update the bold parts to fit your setup. The -E to mail prevents mail from sending anything if the mail body is empty 1 .
You can of course run the script manually on the command line in which case it will tell you the battery levels. Let me know if its useful or doesn’t work on your keyboard/trackpad/etc.!
1. Check that your mail is actually being sent on your system by running date | mail email@example.com.