Notification for long(er) running command line processes (on Mac OS X)

Posted on March 25, 2014

0


It happens several times daily, that I have to fire off a command that will take more than one minute (bundle install, cap deploy, …). This is exactly the time I need to start focussing on other things and forgetting to return often to check on the task. Recently I figured that it  would be great to just get a notification once the command was done(, so I can come back from reading hacker news to continue my work).

Google gave me this stack exchange question and in combination with this one (on the use of Notification Center) I settled on the following aliases for my zsh:

NOTIFICATION='display notification "It is fullfilled." with title "Done"'
alias -g nd='; osascript -e $NOTIFICATION'
alias -g sd='; say done; nd'

This gives my two options: I append ‘sd’ to basically any command (sometimes I have to use ‘; sd’) and I will hear the spoken ‘done’ and see a notification popup. Should I be in a surrounding where the audio channel is not a good choice I can use ‘nd’ and I will just get the Notification Center popup.

Advertisements
Posted in: Uncategorized