Skip to content

Instantly share code, notes, and snippets.

@gartnera
Created April 21, 2024 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gartnera/e00496af19ffbb4c7d1365e87baf8c23 to your computer and use it in GitHub Desktop.
Save gartnera/e00496af19ffbb4c7d1365e87baf8c23 to your computer and use it in GitHub Desktop.
applescript to activate/raise the first notifcation on macos sonoma
tell application "System Events"
-- this is a custom keyboard shortcut for command + control + left arrow (Mission Control -> Show Notification Center)
keystroke (ASCII character 28) using {control down, command down}
end tell
tell application "System Events"
set _first_notification to group 1 of UI element 1 of scroll area 1 of group 1 of window "Notification Center" of application process "NotificationCenter"
-- this activates the notification group
click _first_notification
-- this actually follows the notification
click _first_notification
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment