5

Is there a way to write a custom apple script or any other way to get a Alert or Desktop notification when the battery on my Macbook Pro reaches a certain percentage of charge?

4

This app is a free replacement for the standard battery menu bar item, and it includes the ability to set notifications (in Notification Center) when the battery hits certain percentages.

Alternatively, if you want to rig your own solution, you can get charging status and percentage from running pmset -g batt in the shell. You'd need to poll it rather than getting notified however. If you're comfortable with programming, the IOPowerSources API looks like it can do notifications when the battery/charging status changes, but obviously that's more involved.

1
  • I am trying to achieve the same by creating a login shell daemon or service. Unfortunately, I am no Apple developer and everything I read is quite new to me. Do you know of any Git repositories with worked out examples of the IOPowerSources API? Alternatively, can you please tell me what do you mean by "polling" the pmset -g batt command? Can it be run as a background process at login? Thank you! – Nanashi No Gombe Nov 17 '20 at 8:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .