Created
July 23, 2022 14:28
-
-
Save Sangdol/4d3122f61f1d923718342c55146224b6 to your computer and use it in GitHub Desktop.
An AppleScript that marks notifications as completed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://apple.stackexchange.com/questions/408019/dismiss-macos-big-sur-notifications-with-keyboard | |
my closeNotif() | |
on closeNotif() | |
tell application "System Events" | |
tell process "Notification Center" | |
set theWindow to group 1 of UI element 1 of scroll area 1 of window "Notification Center" | |
# click theWindow if you want to open the app | |
set theActions to actions of theWindow | |
repeat with theAction in theActions | |
if description of theAction is "Complete" then | |
tell theWindow | |
perform theAction | |
# delay to prevent it from stopping in the middle | |
# it's not certain why it stops when there's no delay | |
delay 0.5 | |
my closeNotif() | |
end tell | |
else if description of theAction is "close" then | |
tell theWindow | |
perform theAction | |
delay 0.5 | |
my closeNotif() | |
end tell | |
end if | |
end repeat | |
end tell | |
end tell | |
end closeNotif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment