With OS X Yosemite, Apple introduced widgets for Notification Center. And what a fantastic idea. It basically kills the dashboard, which was pretty much useless. Personally, before Yosemite, I was using the dashboard only to track packages via Deliveries. But now, Deliveries is available on the Mac App Store and guess what? It comes with a widget.
Now all you have to do is wait for developers to update their apps to include widgets or wait for new apps to come out. One of the apps that takes advantage of Yosemite’s NC, is iStat Mini . It costs $1.99 and everybody is going nuts over it. Personally, I think it’s just hype. Basically the app, it’s a stripped down version of iStat Menu and places a widget in NC that shows you CPU, memory, and disk usage. And that’s it.
Well how about doing that for free? May not be as pretty as iStat Mini but… basically you can create and add any widget you can think of in NC this way.
Jump over the break to check out how to do it…
First of all, if you don’t use dashboard ( don’t see why would you ) just disable it. To do that go to System Preferences > Mission Control and turn it off
Now let’s meet “Today Scripts” a nice little app created by 5HT-2a. So what exactly is Today Scripts? A widget that allows you to customize a list of shell scripts which run when you open Notification Center, then print out the result of the script, as well as an indication of success or failure.
Basically if you can use it in Terminal.app you can create a widget out of it.
Sounds fun? It is! The only problem with Today Scripts is that it is still in development. There are some bugs ( listed below ) and it’s not polished.
Let’s see how to use Today Scripts….
1. Download Today Scripts and place it somewhere on your Mac – for example /Applications/
2. Open the app ( nothing will happen ). NOTE: OS X might not let you open the app because it’s not from “a trusted source” In that case, go to System Preferences > Security & Privacy > General and follow the instructions below
3. Launch Notification Center, and at the bottom you will notice that it says “1 New”. Click on that
4. From the list of available widgets, drag-and-drop “Scripts” in the Notification Center
5. Now here’s where the fun begins. Adding widgets. I’ll use CPU Usage as an example. Next to “Scripts” click on the information icon
6. Adding the widget. All you have to do is give it a name ( CPU Usage ) and paste in the code ( in this case this script uses /bin/bash
as its interpreter )
ps xro %cpu=,comm= | while read cpu comm; ((i++<5)); do echo $cpu% $(basename “$comm”); done
7. Click “Add Script”. And you’re done. Now how easy was that?
Other useful scripts that you can add:
Display the top five processes by RAM usage:
ps xmo rss=,pmem=,comm= | while read rss pmem comm; ((i++<5)); do echo “$[rss/1024]M ($pmem%) $(basename “$comm”)”; done
Temperature readings (requires Temperature Monitor 4.98)
/Applications/TemperatureMonitor.app/Contents/MacOS/tempmonitor -a -l -f | while read reading; do
set — $reading;temperature=”${@:$[$#-1]:1}”;
sensor=”${@:2:$[$#-3]}”;
sensor=”${sensor:0:$[${#sensor}-1]}”;
sensor=”${sensor//(}”;
sensor=”${sensor//)}”;
sensor=”$(echo “${sensor:0:32}” | tr ‘[:lower:]’ ‘[:upper:]’)”;
short=$[32-${#sensor}];
i=0;
while ((i++ < short)); do sensor=”$sensor “; done;echo “$sensor”$’ \e[35m'”${temperature}°F”$’\e[0m’;
done;
See the usage of all your storage volumes:
df -Hl | { read keys; keys=”${keys%% on}”; while read ${keys//%}; do echo “`basename “$Mounted”` – $Used/$Size ($Capacity)”; done }
Test if a server is online:
ping -c1 -t1 example.com > >(read; read stats; echo “$stats”) 2>&-;
Display your uptime:
uptime
Check your battery status:
pmset -g batt | { read; read n status; echo “$status”; }
Quote of the day
curl –silent www.brainyquote.com/quotes_of_the_day.html | egrep ‘(span class=\”bqQuoteLink\”)|(div class=\”bq-aut\”)’ | sed -n ‘1p; 2p; ‘ | sed -e ‘s/<[^>]*>//g’
Known Bugs
1. Cannot properly handle interactive programs. When specifying an interactive shell such as Bash, take care not leave the script box blank.
2/ For the same reason, cannot appropriately handle scripts which take an inordinate amount of time to complete. These issues will be fixed in the next release.
If you run into trouble, paste the following line into Terminal to reset the widget, then restart your computer:
rm -R ~/Library/{Group\ ,}Containers/org.samroth.*
Also keep an eye on this reddit thread to see when the app will be updated.