#!/bin/sh

set -eu

main() {
  find /System/Library/LaunchDaemons /System/Library/LaunchAgents -name "*.plist" \
    | while read -r p; do
      plutil -convert json -o - "${p}" \
        | jq -r ' ..
          | objects
          | with_entries(select(.key == "Notification"))
          | select(. != {}).Notification'
    done | sort -u
}

main >~/Downloads/all-launchd-notifications.txt
if test -e ~/Downloads/all-launchd-notifications.txt; then
  cat ~/Downloads/all-launchd-notifications.txt
fi
exit 0
