Created
March 7, 2017 13:08
-
-
Save staltz/c9c575525bc55043b71f8f0e16b214e3 to your computer and use it in GitHub Desktop.
Show a macOS notification when a terminal task is done
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name it whatever you want. I like `y` because in my keyboard layout it's close to `;` | |
function y() { | |
previous=$? | |
if [ $previous -eq 0 ]; then | |
osascript -e "display notification \"Done\" with title \"Terminal Task\"" && say "it is done"; | |
else | |
osascript -e "display notification \"Failed\" with title \"Terminal Task\"" && say "it went to the trees"; | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm test ;y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For
zsh
see: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/bgnotify