
Show OS X notification when long running cmd finishes and terminal not in focus - tilt
http://frantic.im/notify-on-completion
======
dandelany
My lightweight solution is to append `&& tput bel` to long-running commands,
to ring the terminal bell upon completion :) Requires sound of course, but
it's reasonably easy to remember and quick to type. eg. try `sleep 5 && tput
bel`

I've also used a similar cheap hack to listen to web traffic... Just write a
bell character to your server log when something interesting happens, then
`tail -f` the log file for live data sonification!

~~~
hyperjeff
also fun is to append `osascript -e 'say "all done!"'` or somesuch if you're
within decent earshot. you can even pipe in context-specific info.

~~~
corecoder
Shouldn't `say 'all done!'` just work without the osascript part?

~~~
hyperjeff
oh, geez, yes of course. sorry, old habit from before the say command.

------
eridius
Clever, but compiling and executing an AppleScript every single time any
command finishes seems a bit overkill.

Does zsh have a way to see how long the last command took? You could at least
have this only do the check if the command took more than one or two seconds.
That would cut out a lot of the unnecessary checks.

~~~
mayoff
You could pre compile the script with osacompile if you want, but I wouldn't
bother.

I think checking the command runtime would be a mistake. If you expect the
command to take a long time, and it finished in just a second or two, you
probably want to be notified immediately rather than eventually wondering many
minutes later why you weren't. And if you expect the command to take only a
second or two, you are a lot less likely to be tabbing away, so you won't be
notified anyway.

------
jason_slack
This might be useful to me.

What is the app in the foreground, in the screenshot at the bottom? Looks like
a multi-tabbed text editor?

------
cozzyd
Gnome-terminal does this out of the box, but it doesn't work in tmux or over
SSH connections.

