-
-
Save hnagato/753022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: http://d.hatena.ne.jp/umezo/20100508/1273332857 | |
local COMMAND="" | |
local COMMAND_TIME="" | |
function _growl_lazy_precmd() { | |
if [ "$COMMAND_TIME" -ne "0" ] ; then | |
local d=`date +%s` | |
d=`expr $d - $COMMAND_TIME` | |
if [ "$d" -ge "5" ] ; then | |
COMMAND="$COMMAND " | |
growlnotify -t "${${(s: :)COMMAND}[1]}" -m "$COMMAND" | |
fi | |
fi | |
COMMAND="0" | |
COMMAND_TIME="0" | |
} | |
function _growl_lazy_preexec() { | |
COMMAND="${1}" | |
if [ "`perl -e 'print($ARGV[0]=~/ssh|^vi/)' $COMMAND`" -ne 1 ] ; then | |
COMMAND_TIME=`date +%s` | |
fi | |
} | |
autoload -Uz add-zsh-hook | |
add-zsh-hook precmd _growl_lazy_precmd | |
add-zsh-hook preexec _growl_lazy_preexec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment