Skip to content

Commit

Permalink
Merge pull request #973 from dlvhdr/patch-1
Browse files Browse the repository at this point in the history
Update dismiss-notifications.applescript to work on Sequoia
  • Loading branch information
giedreblekaite authored Dec 10, 2024
2 parents 4b0811a + 43da0f6 commit 0db64cf
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions commands/system/dismiss-notifications.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@

# Documentation:
# @raycast.description Close all notification alerts staying on screen, e.g., Calendar notifications.
# @raycast.author benyn
# @raycast.authorURL github.com/benyn
# @raycast.author dlvhdr
# @raycast.authorURL github.com/dlvhdr

tell application "System Events"
tell process "NotificationCenter"
if not (window "Notification Center" exists) then return
set alertGroups to groups of first UI element of first scroll area of first group of window "Notification Center"
repeat with aGroup in alertGroups
try
perform (first action of aGroup whose name contains "Close" or name contains "Clear")
on error errMsg
log errMsg
end try
tell application "System Events" to tell application process "NotificationCenter"
try
repeat with uiElement in (actions of UI elements of scroll area 1 of group 1 of group 1 of window "Notification Center" of application process "NotificationCenter" of application "System Events")
if description of uiElement contains "Close" then
perform uiElement
end if
if description of uiElement contains "Clear" then
perform uiElement
end if
end repeat
-- Show no message on success
return ""
end tell
return ""
end try
end tell

0 comments on commit 0db64cf

Please sign in to comment.