I think the OS X Human Interface Guidelines are the place you're looking for. They state that there are Apple-reserved shortcuts (e.g. cmd ⌘+space) and also “expected behaviours” (e.g. cmd ⌘+c) one should respect.
While they don't explicitly state the priority, it suggests itself that the System always should have priority before the frontmost (active) and then background applications.
From my experience, you’re on the safe side with multiple modifier keys (i.e. cmd ⌘+ctrl+shift+…).
As an aside: regarding your specific example (assigning a shortcut to open a new terminal) there's also excellent apps for that, TotalTerminal (Terminal.app extension) and iTerm 2 (Terminal.app replacement) come to mind
You can create Automator service to run this Applescript and give it a keyboard shortcut in the System Preferences Keyboard shortcuts
This will close Alert and banners Notification
In Automator choose a new service
Add a Run Applescript Action
and replace it's code with:
my closeNotif()
on closeNotif()
tell application "System Events"
tell process "Notification Center"
set theWindows to every window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
try
click button 1 of this_item
on error
my closeNotif()
end try
end repeat
end tell
end tell
end closeNotif
Set the 'Service receives [no input] in [any application]'
Save the service.
Open the Keyboard shortcuts in System prefs and set your for your service under 'Services'
Now any newly launched app will pick the shortcut up.
(Note: I structured the script to counter throwing an error that will occur when the notifications/windows start to close.
otifications/window are numbered 1 through to the total count. But as they close the script would still be working of the old count.
But the system will be re assigning the index of the windows.
So where we say start at 1 -6 the script will try and close window 1, window 2, window 3 and so on. But the system has re assigned the window numbers 1,2,3 to the last remaining windows. But the script will try and close window 4 and throw an error because it does not exist. The script will catch this and deal with it. )
If you want to click the 'Show' button on an Alert Notification.
you change the button you click from 1 to 2.
click button 2 of this_item
Banner notifications do not have a button 2.
But you can just click the window.
So this code should take care of Showing.
my closeNotif()
on closeNotif()
tell application "System Events"
tell process "Notification Center"
set theWindows to every window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
set cnt to count buttons of this_item
try
if cnt > 1 then
click button 2 of this_item
else
click this_item
end if
on error
closeNotif()
end try
end repeat
end tell
end tell
end closeNotif
Best Answer
It's the new feature in Mojave. You can show Screenshot/Screen Capture menu with ⌘ cmd+⇧ shift+5.