Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
何かのインストールなどの長い処理のときにgrowlで通知してくれるzsh growlが使えるときのみ発動するようにしてみた
# source: http://d.hatena.ne.jp/umezo/20100508/1273332857
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 "
which growlnotify > /dev/null 2>&1 && growlnotify -t "${${(s: :)COMMAND}[1]}" -m "$COMMAND";
fi
fi
COMMAND="0"
COMMAND_TIME="0"
}
preexec () {
COMMAND="${1}"
if [ "`perl -e 'print($ARGV[0]=~/ssh|^vi/)' $COMMAND`" -ne 1 ] ; then
COMMAND_TIME=`date +%s`
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.