Don't notify when select commands exit
This commit is contained in:
parent
7aa78e94d1
commit
e829a84dde
@ -45,7 +45,32 @@ notify() {
|
|||||||
|
|
||||||
# Send a desktop notification when long running commands complete.
|
# Send a desktop notification when long running commands complete.
|
||||||
notify_command_threshold=60
|
notify_command_threshold=60
|
||||||
|
notify_ignore_list=(
|
||||||
|
git
|
||||||
|
nvim
|
||||||
|
ssh
|
||||||
|
sudo
|
||||||
|
sudoedit
|
||||||
|
tmux
|
||||||
|
vi
|
||||||
|
vim
|
||||||
|
)
|
||||||
|
# TODO: append include any of ${(k)aliases} is they contain any of the above
|
||||||
|
notify-ignore() {
|
||||||
|
echo "$1"
|
||||||
|
for ignore in $notify_ignore_list; do
|
||||||
|
echo "ignore: $ignore"
|
||||||
|
if [ "$1" = "$ignore"* ]; then
|
||||||
|
echo "ignored: $1"
|
||||||
|
# return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# return 1
|
||||||
|
}
|
||||||
notify-preexec() {
|
notify-preexec() {
|
||||||
|
# if notify-ignore $1; then
|
||||||
|
# return
|
||||||
|
# fi
|
||||||
notify_command_start=`date +%s`
|
notify_command_start=`date +%s`
|
||||||
notify_command=$1
|
notify_command=$1
|
||||||
}
|
}
|
||||||
@ -56,6 +81,8 @@ notify-precmd() {
|
|||||||
if [[ $notify_command_time -gt $notify_command_threshold ]]; then
|
if [[ $notify_command_time -gt $notify_command_threshold ]]; then
|
||||||
notify "completed: $notify_command"
|
notify "completed: $notify_command"
|
||||||
fi
|
fi
|
||||||
|
unset notify_command
|
||||||
|
unset notify_command_start
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
add-zsh-hook preexec notify-preexec
|
add-zsh-hook preexec notify-preexec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user