prezto/modules/notify/init.zsh

26 lines
514 B
Bash
Raw Normal View History

2013-06-13 03:48:24 -04:00
# Notifies if the last command completes and terminal window is not in
# foreground.
#
# Authors:
# Alex Reece <awreece@gmail.com>
#
pmodload 'helper'
2013-06-13 03:48:24 -04:00
if should_auto_notify; then
pmodload 'last_command'
2013-06-13 03:48:24 -04:00
# Initialize $terminal_window_id to the current active window.
terminal_window_id=$(focused_window_id)
2013-06-13 03:48:24 -04:00
function notify_precmd {
if [[ $(focused_window_id) != $terminal_window_id ]]; then
notify_last_command
fi
}
2013-06-13 03:48:24 -04:00
autoload -Uz add-zsh-hook
2013-06-13 03:48:24 -04:00
add-zsh-hook precmd notify_precmd
fi