OS X’s UI looks nice, but isn’t very keyboard-friendly. For example, there is no standard shortcut to expand or minimize a window (yes, Cmd+M typically works, but it depends on the Window > Minimize menu command, which is sometimes not present). The same is true for the notification center, specifically calendar invitations/reminders that display a notification popup by default with two buttons: Close and Accept/Remind later. How do you dismiss it with the keyboard alone?
Luckily someone already came up with an AppleScript (another invention from apple) to click the first button on the notification. The source is on StackExchange; I’m reposting it here:
You can open this script in the Script Editor.app, select File > Export…, set “File Format:” to “Application”, save to e.g. ~/bin/. I use Alfred and don’t know if it’s the default or not, but after saving the “application”, it’s immediately available in Alfred. It’s very quick to open its window and type clo, in my case the first search result is the application.
One more note: on first launch, it’ll ask for accessibility to access other processes. You’ll need to go to System Preferences > Security & Privacy > Privacy > Accessibility, possibly unlock it with your password, and enable accessibility for close_notif.app.
It works well. Nevertheless, it is annoying that there is no standard way to do that in the system.