Dismiss Notifications With a Keyboard Shortcut Using Automator

It can be annoying to have notifications appear at the top right corner of your screen while you are typing. Normally, you have to move the cursor to click on the Close button to dismiss those. However, you can build a simple JavaScript service in Automator to do it, and then use a keyboard shortut to trigger that service.

function run(input, parameters) {
	var app = Application('System Events');
	app.includeStandardAdditions = true;
	app.processes.byName('Notification Center').windows.buttons[0].click();

	return input;
}

Comments: 4 Responses to “Dismiss Notifications With a Keyboard Shortcut Using Automator”

    Ros
    2 months ago

    When I open System Preferences and select Notifications, Automator does not appear in the left hand pane. So I cannot
    select “Alert” (or “Banners”, or “None”)

    Ak
    2 months ago

    When I try the script in Automator and in the apps all runs well but when I want to do it with the shortcut it takes me to Automator

    Lee Taylor
    1 month ago

    Running MacOS High Sierra, version 10.13.6, (which is the highest I can go on my Mid 2011 Mac) & File -> New doesn’t show “Quick Action”. Working with Apple Support, we uncovered a software ERRORwith MacOS later than El Captain where Mail.app beeps regardless of turning off “sound” in Notifications within System Preferences. Since I average 200 emails/day, it’s important to resolve this issue.
    Do you have any recommendation? Would this Automator app work with either “Workflow”/”Application”?

    1 month ago

    Lee: Quick Actions are new in Mojave. In High Sierra “Services” are the closest. To turn off the Mail sound, you don’t do that in Notifications preferences. It is in Mail, Preferences, General.

Leave a New Comment Related to "Dismiss Notifications With a Keyboard Shortcut Using Automator"

:
:
:
0/500 (500 character limit -- please state your comment succinctly and do not try to get around this limit by posting two comments)