Skip to content

Instantly share code, notes, and snippets.

@rosylilly
Created August 19, 2011 08:49
Show Gist options
  • Save rosylilly/1156366 to your computer and use it in GitHub Desktop.
Save rosylilly/1156366 to your computer and use it in GitHub Desktop.
Growl Notify for zsh
# 時間がかかったらgrowlで終了通知
local COMMAND=""
local COMMAND_TIME=""
precmd() {
if [ "$COMMAND_TIME" -ne "0" ] ; then
local d=`date +%s`
d=`expr $d - $COMMAND_TIME`
if [ "$d" -ge "30" ] ; then
COMMAND="$COMMAND "
echo -ne "\a"
growlnotify -t "${${(s: :)COMMAND}[1]}" -m "$COMMAND"
fi
fi
COMMAND="0"
COMMAND_TIME="0"
}
preexec () {
COMMAND="${1}"
COMMAND_TIME=`date +%s`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment