How To: Add Battery, CPU, Memory, & Other Custom Usage Stats to Your Mac's Notification Center

Add Battery, CPU, Memory, & Other Custom Usage Stats to Your Mac's Notification Center

On mobile devices, the Notification Center received a huge facelift when iOS 8 was released, but it wasn't until Yosemite that its Mac OS X counterpart received the same amount of love—especially the much needed ability to add custom widgets, like a FaceTime dialer.

Now, thanks to Reddit user 5HT-2a, you can add custom scripts to your Mac's Notification Center to display anything from memory usage to hard drive temperature at a glance using the Today Scripts widget.

Step 1: Install Today Scripts

Once you've downloaded Today Scripts, open the DMG file and place the app somewhere safe (like in your Applications folder). Before you can add it to your Notification Center, you'll have to open it up first (no app will actually open, but the widget will be added to your Notification Center).

If your Gatekeeper security settings are too high, you might not be able to open the app right away. To allow an exception, check out our guide on installing third-party apps from outside of the Mac App Store.

Step 2: Add It to the Notification Center

Once you've made an exception in your security settings (if needed), head to your Notification Center and click on the "1 New" button at the bottom.

Drag and drop "Scripts" over from the list of available widgets to where you'd like in the main Notification section.

Step 3: Start a New Script

Click on "Done," then on the letter "i" (for "information") that appears next to it. Now you will see the script editor where you will have to add a "Label," "Program," and the actual script that will give you your desired output. In this case, I will add a memory usage widget using the default "/bin/bash" as the program.

Example: Memory Usage Script

ps xmo rss=,pmem=,comm= | while read rss pmem comm; ((n++<5)); do

size="$rss/1024";
short=$4-${#size};
size="(${size}M)";
i=0;
while ((i++ < short)); do size=" $size"; done;

pmem="${pmem%%.*}"
if (($pmem >= 20)); then color=$'\e31m';
elif (($pmem >= 10)); then color=$'\e33m';
else color=$'\e32m ';
fi;

echo "$color$pmem% $size $(basename "$comm")"$'\e0m'"";
done

Step 4: Add the Script

Once you have the editor form filled out, simple click on "Add Script."

Step 5: Try Out Other Scripts (Optional)

Of course, you can try your hand at making your own scripts, but here are a few others pre-made ones to get you stated:

CPU Usage:

ps xro %cpu=,comm= | while read cpu comm; ((i++<5)); do echo $cpu% $(basename "$comm"); done

Display Uptime:

uptime

Battery Status:

pmset -g batt | { read; read n status; echo "$status"; }

Step 6: Resetting Troublesome Widgets (When Needed)

If at anytime you run into an issue with your widget, you can reset the entire thing by entering the following command into a Terminal window:

  • rm -R ~/Library/{Group\ ,}Containers/org.samroth.

This just skims the surface of the possibilities of Today Scripts (more details can be found on its GitHub page), so if you come up with any cool scripts of your own, be sure to drop a comment below or on our Facebook and Twitter feeds.

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

Be the First to Comment

Share Your Thoughts

  • Hot
  • Latest