I'm weird. We all have our weird habits and quirks. Luckily for me, mine only involves my the battery in my macbook computer.
Are you worried about keeping your devices' batteries healthy and keeping a charge? With every device I have owned, battery health has degraded noticeably over time, likely due to my poor charging habits.
I'll be the first to admit, I am no electrochemist. I might be (and likely am) askew, and what I am about to show you may have absolutely no effect on battery performance. But, I like to believe it does :)
I wanted a way to get a notification when my battery reaches 40% and 80%. That's my target range. So I wrote a script to do it (I have no life). It is written in AppleScript, and uses a fancy-pants notification card to display a message when it's time to charge or unplug the charge cable. The script relies on Apple's task scheduler launchd
, and by following these instructions, the script will run automatically after login.
First, you will need to download the two files below BatteryStatusNotification.scpt
and battery.monitor.plist
. Make sure you edit the plist
file to point to the correct script file.
If you want to run the script once, just run osascript BatteryStatusNotification.scpt
. This is fine, but won't automatically run the script on login. To do this, copy the plist
file battery.monitor.plist
to ~/Library/LaunchAgents/
. I recommend placing the script under ~/Applications
.
Test this out and let me know what you think! You can also easily adjust the boundaries, or modify the script to suit your needs.
Stack Exchange - How to run custom AppleScript in Background
Hey there. I have been looking for something like this for so long and when I finally find it, I can't make it work... The whole auto process did not work for me so I tried running the script and it doesn't work either. What I might be doing wrong? I have attached the scripts so you can see the path where I add them and the code.
Looking forward to hearing from you.
Thanks