Skip to content

Commit 0db64cf

Browse files
Merge pull request #973 from dlvhdr/patch-1
Update dismiss-notifications.applescript to work on Sequoia
2 parents 4b0811a + 43da0f6 commit 0db64cf

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

commands/system/dismiss-notifications.applescript

+13-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,19 @@
1111

1212
# Documentation:
1313
# @raycast.description Close all notification alerts staying on screen, e.g., Calendar notifications.
14-
# @raycast.author benyn
15-
# @raycast.authorURL github.com/benyn
14+
# @raycast.author dlvhdr
15+
# @raycast.authorURL github.com/dlvhdr
1616

17-
tell application "System Events"
18-
tell process "NotificationCenter"
19-
if not (window "Notification Center" exists) then return
20-
set alertGroups to groups of first UI element of first scroll area of first group of window "Notification Center"
21-
repeat with aGroup in alertGroups
22-
try
23-
perform (first action of aGroup whose name contains "Close" or name contains "Clear")
24-
on error errMsg
25-
log errMsg
26-
end try
17+
tell application "System Events" to tell application process "NotificationCenter"
18+
try
19+
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")
20+
if description of uiElement contains "Close" then
21+
perform uiElement
22+
end if
23+
if description of uiElement contains "Clear" then
24+
perform uiElement
25+
end if
2726
end repeat
28-
-- Show no message on success
29-
return ""
30-
end tell
27+
return ""
28+
end try
3129
end tell

0 commit comments

Comments
 (0)