Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

command completion notification

Forgive me, as it has been a few years since my last email…

In OS X, 10.8 (aka Mtn Lion), Apple has introduced a notification system.  Using gem, I installed a command-line utility called terminal-notifier.

I wrote a simple function to test its capabilities:

function tnot { "$@" && terminal-notifier -message "$( echo $@ ) returned $?" -title "Command $HISTCMD Completed" >|/dev/null }

Now if I issue a command like

tnot  sleep 12

It will post a notification on the screen and log the notification to the so-called notification center where all the nagging notices pile up.

This isn't particularly elegant.  I would rather use this as a preexec function, or something similar, so I wouldn't have to explicitly type "tnot".  However, there are only a small subset of commands I would want to bind to a notification.

Is it straightforward to somehow bind this to, say, control-return, or some other modified return key sequence?


Bill Scott

William G. Scott
Department of Chemistry and Biochemistry
and The Center for the Molecular Biology of RNA
228 Sinsheimer Laboratories
University of California at Santa Cruz
Santa Cruz, California 95064

Messages sorted by: Reverse Date, Date, Thread, Author