I find notifications somewhat useful, but I hate managing them in Notification Center. They stack up uselessly and must be dismissed by hand. Can Notification Center notifications be configured to expire after some time? Note: I don't mean the difference between "banners" and "alerts," I want the alerts to go away from the Notification Center on their own after some length of time. I also don't mean the ability to turn off notifications per application.
2 Answers
According to this old thread - looks, that it doesn't and I'm afraid it didn't change anything since then.
https://discussions.apple.com/thread/5053666
Nope. There's a limit on the number of items in a section, but they don't "expire" and disappear. You could click that little X and be done with 3 of them right there 😁
-
1
Here is some AppleScript that works for me on MacOS Monterey. Open the Script Editor, paste this and run the code (Cmd+R).
on closeNotifs(numTimes)
repeat numTimes times
try
tell application "System Events" to tell application process "NotificationCenter"
set boxes to groups of UI element 1 of scroll area 1 of window 1
set numBoxes to count boxes
repeat with i from numBoxes to 1 by -1
try
perform item 1 of (actions of item i of boxes whose name starts with "Name")
end try
end repeat
end tell
end try
end repeat
end closeNotifs
closeNotifs(2)
log "done"
Instead of whose name starts with "Name"
you may use whose name description is "Close"
but I don't have English settings. I think this should work for any language.
I haven't solved the problem that the last notification is not closed automatically, so I basically run it twice.
This has been a PITA for so long.
Now to get it to work as a shortcut, you might have to create a unix script with
#!/usr/bin/osascript
on closeNotifs(numTimes)
repeat numTimes times
try
tell application "System Events" to tell application process "NotificationCenter"
set boxes to groups of UI element 1 of scroll area 1 of window 1
set numBoxes to count boxes
repeat with i from numBoxes to 1 by -1
try
perform item 1 of (actions of item i of boxes whose name starts with "Name")
end try
end repeat
end tell
end try
end repeat
end closeNotifs
closeNotifs(2)
log "done"
Save this as a file e.g.
/usr/local/bin/stfu
then set it as an executable
chmod +x /usr/local/bin/stfu