Skip to content

Instantly share code, notes, and snippets.

@gingerbeardman
Created June 1, 2025 19:20
Show Gist options
  • Select an option

  • Save gingerbeardman/9c2df74528c8ff911bc1f09ef942941c to your computer and use it in GitHub Desktop.

Select an option

Save gingerbeardman/9c2df74528c8ff911bc1f09ef942941c to your computer and use it in GitHub Desktop.

Revisions

  1. gingerbeardman created this gist Jun 1, 2025.
    16 changes: 16 additions & 0 deletions dismiss_notifications.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    osascript -e '
    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
    end repeat
    -- Show no message on success
    return ""
    end tell
    end tell'