-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zsh-notify.zsh
36 lines (26 loc) · 1 KB
/
zsh-notify.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env ksh
# -*- coding: utf-8 -*-
#
# Defines install notify for osx or linux.
#
# Authors:
# Luis Mayta <[email protected]>
#
zmodload zsh/regex
ZSH_NOTIFY_PATH=$(dirname "${0}")
# shellcheck source=/dev/null
source "${ZSH_NOTIFY_PATH}"/config/main.zsh
# shellcheck source=/dev/null
source "${ZSH_NOTIFY_PATH}"/internal/main.zsh
# shellcheck source=/dev/null
source "${ZSH_NOTIFY_PATH}"/pkg/main.zsh
# notify if commands was running for more than TIME_THRESHOLD seconds:
typeset -g _ZSH_NOTIFY_TIME_THRESHOLD=10
typeset -g _ZSH_NOTIFY_RE_SKIP_COMMANDS="^[^ ]*(ssh|vi|vim|nvim|tmux|tig|man|cat|more|less)"
typeset -g _ZSH_NOTIFY_TERMINAL_BUNDLE="com.googlecode.iterm2"
# For this script to be able to get the exit status of the last executed command ($?)
# it must be loaded before any other script or function that adds a precmd hook.
# Only the first precmd hook access the original $?.
autoload -Uz add-zsh-hook
add-zsh-hook preexec notify::command::store
add-zsh-hook precmd notify::command::completed