Advertisement
Guest User

Untitled

a guest
May 29th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. ## zsh/growl integration: any command that takes longer than 5 seconds
  2. ## will trigger a growl notification when it completes.
  3.  
  4. case $OSTYPE in
  5. darwin*)
  6. notify="growlnotify"
  7. notifyo=$notify" -m"
  8. ;;
  9. linux*)
  10. notify="notify-send"
  11. ;;
  12. esac
  13.  
  14. if which $notify > /dev/null 2>&1; then
  15. preexec() {
  16. zsh_growl_cmd=$1
  17. zsh_growl_time=`date +%s`
  18. }
  19.  
  20. precmd() {
  21. if (( $? == 0 )); then
  22. zsh_growl_status=done
  23. else
  24. zsh_growl_status=fail
  25. fi
  26. if [[ "${zsh_growl_cmd}" != "" ]]; then
  27. if (( `date +%s` - ${zsh_growl_time} > 5 )); then
  28. $notify ${zsh_growl_cmd} ${zsh_growl_status}
  29. fi
  30. fi
  31. zsh_growl_cmd=
  32. }
  33. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement