How to set battery level notification on MacBook, when it is under 20 %? (macOS Ventura)

Hi everybody!


I'd like to ask You a question - is it possible to set battery level notification on MacBook, when it is under 20 % (same way as it is on iPhone)?


I've just found, that it is possible via third party software, but I'd rather use somehow native option in settings, but i could not find it, or an Apple app, if it's possible. Any ideas? I've tried shortcuts, but without automatization it is not working properly, Automator + AppleScript weren't working either.


It will be cool, if this feature in Settings in options for battery appears in an update or a new version.


Thank You for Your help.


Majkinho

Posted on Jul 20, 2023 8:49 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 12, 2023 9:56 AM

I’ve asked ChatGPT for a solution to this and it came up with a script you can run in the Apple Automation app:


Certainly! Here are the instructions for the updated script to be posted on the Apple website:


**Instructions:**

1. Open the "Automator" app on your Mac.


2. Create a new task: Select "New Document" and choose "Application."


3. Search for actions: In the left sidebar of Automator, search for "Run AppleScript" and drag it into the workflow area on the right.


4. Write the AppleScript code: In the "Run AppleScript" window, replace the default code with the following code:


```applescript

on idle

set battery_percentage to do shell script "pmset -g batt | grep -o '\\d\\+%'"

set battery_percentage to text 1 thru -2 of battery_percentage as integer

if battery_percentage is less than 30 then

display dialog "Your battery percentage is lower than 30%. Please connect your MacBook to the charger!" buttons {"OK"} default button "OK"

end if

-- Run the script every 15 minutes (900 seconds)

return 900

end idle

```


5. Save and test: Go to "File" and choose "Save." Save the application with a name you prefer, for example, "BatteryCheck." Close Automator.


6. Automatically run at startup: You can add the "BatteryCheck" application to your startup items. To do this, go to Apple Menu > System Preferences > Users & Groups > Login Items, and click the "+" button to add your "BatteryCheck" application.


With these instructions, users can create an application that will automatically check their MacBook's battery percentage and display a warning if it drops below 30% every 15 minutes. This script is designed to be efficient and should work with the latest macOS version.

29 replies

Jul 2, 2024 12:50 AM in response to queen4

Actually, it was bit annoying getting a notification every minute while the battery was at 80%, so I modified my shortcut:



You'll want to create a file called battery.txt which just contains any number initially, and modify the shortcut to use your filepath for battery.txt. This file will store the previous battery level the last time the script ran, so that we can check if the battery level changed since the last time the script ran.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to set battery level notification on MacBook, when it is under 20 %? (macOS Ventura)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.