Skip to content

Instantly share code, notes, and snippets.

@somewhatabstract
Last active July 30, 2025 23:39
Show Gist options
  • Save somewhatabstract/fae01eb628c5975f1d551a8ea9b28d40 to your computer and use it in GitHub Desktop.
Save somewhatabstract/fae01eb628c5975f1d551a8ea9b28d40 to your computer and use it in GitHub Desktop.
Simple bash commands for displaying notifications/alerts on macOS; useful for adding a toast on command completions
notify() {
osascript -e "display notification \"$2\" with title \"$1\" sound name \"${3:-default}\""
}
alert() {
("$@" && notify "✅ Success!" "$(echo "$@")" Blow) || notify "⚠️ Oh noes!" "$(echo "$@")" Sosumi
}
alias 🚨=alert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment