Jake.codes

Toggle Notification Center Alerts, for OS X

Sunday, May 26, 2013

This never quite worked reliably, but it should toggle notifications from Notification Center on OS X.

#!/bin/bash
CURRENTLY=`defaults read ~/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist doNotDisturb`;
if [ $CURRENTLY == 0 ]; then
    defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist doNotDisturb -boolean true;
else
    defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist doNotDisturb -boolean false;
fi
killall NotificationCenter;