Skip to content

Commit 5b62b3b

Browse files
benyndehesa
authored andcommitted
Create dismiss-notifications.applescript
1 parent a8631e5 commit 5b62b3b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/osascript
2+
3+
# Required parameters:
4+
# @raycast.schemaVersion 1
5+
# @raycast.title Dismiss Notifications
6+
# @raycast.mode silent
7+
8+
# Optional parameters:
9+
# @raycast.icon 🔕
10+
# @raycast.packageName System
11+
12+
# Documentation:
13+
# @raycast.description Close all notification alerts staying on screen, e.g., Calendar notifications.
14+
# @raycast.author benyn
15+
# @raycast.authorURL github.com/benyn
16+
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
27+
end repeat
28+
-- Show no message on success
29+
return ""
30+
end tell
31+
end tell

0 commit comments

Comments
 (0)