After listening to a recent Mac Power Users episode on notifications, I decided it was finally time to reduce the flood of notifications I get on my Mac. I realized that the biggest obstacle for me with notifications on the Mac is the inconsistent behavior when I two-finger-edge-swipe to open the notification center: sometimes I get the Today view, and sometimes I get the Notifications view, depending on what I was last looking at it.
There doesn’t seem to be a keyboard shortcut you can use to toggle between the Today and Notifications tabs, so I decided to script it. As a starting point, I found this Stack Overflow answer, but the Applescript didn’t work on Sierra. This answer provided the information I needed to debug the first script; it turns out that the "Notification Center"
item moved from menu bar 2
to menu bar 1
with an OS update.
This is the script I ended up with to show the Today tab:
tell application "System Events" to tell process "SystemUIServer"
click menu bar item "Notification Center" of menu bar 1
end tell
tell application "System Events" to tell process "NotificationCenter"
click radio button "Today" of radio group 1 of window "NotificationTableWindow"
end tell
And this is the script for the Notifications tab:
tell application "System Events" to tell process "SystemUIServer"
click menu bar item "Notification Center" of menu bar 1
end tell
tell application "System Events" to tell process "NotificationCenter"
click radio button "Notifications" of radio group 1 of window "NotificationTableWindow"
end tell
I’ve tied these gestures in Better Touch Tool, and I can also fire them off from LaunchBar.