Skip to content

Instantly share code, notes, and snippets.

@juanger
Created January 17, 2013 17:39
Show Gist options
  • Save juanger/4557831 to your computer and use it in GitHub Desktop.
Save juanger/4557831 to your computer and use it in GitHub Desktop.
if growlnotify -h &>/dev/null; then
preexec() {
zsh_growl_cmd=$1
zsh_growl_time=`date +%s`
}
precmd() {
if (( $? == 0 )); then
zsh_growl_status=done
zsh_growl_priority=Normal
else
zsh_growl_status=fail
zsh_growl_priority=Emergency
fi
if [[ "${zsh_growl_cmd}" != "" ]]; then
if (( `date +%s` - ${zsh_growl_time} > 5 )); then
growlnotify -n 'term-notify' -p ${zsh_growl_priority} -m ${zsh_growl_cmd} ${zsh_growl_status}
fi
fi
zsh_growl_cmd=
}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment