Skip to content

Instantly share code, notes, and snippets.

@Ryel
Created November 14, 2024 16:44
Show Gist options
  • Save Ryel/fd23e431bdcbb04e627a8af45c27a853 to your computer and use it in GitHub Desktop.
Save Ryel/fd23e431bdcbb04e627a8af45c27a853 to your computer and use it in GitHub Desktop.
send push notification from command line
# send push notification when slow task finishes (MacOS only)
# notify func as one-liner (e.g. for alias)
osascript -e 'display notification "foo" with title "bar"'
# add bash script with notify func
{
echo '#!/bin/bash'
echo '/usr/bin/osascript -e "display notification \"$*\""'
} | sudo tee /usr/local/bin/notify > /dev/null && sudo chmod +x /usr/local/bin/notify
# example:
# slow_task; notify slow_task finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment