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.

Revisions

  1. Ryel created this gist Nov 14, 2024.
    13 changes: 13 additions & 0 deletions notify.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # 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