Notify via OSC 9 after long running command completes
This commit is contained in:
parent
42260925a0
commit
7aa78e94d1
@ -43,6 +43,24 @@ notify() {
|
|||||||
tmux-dcs-passthrough '\x1b]9;'"$*"'\x7'
|
tmux-dcs-passthrough '\x1b]9;'"$*"'\x7'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Send a desktop notification when long running commands complete.
|
||||||
|
notify_command_threshold=60
|
||||||
|
notify-preexec() {
|
||||||
|
notify_command_start=`date +%s`
|
||||||
|
notify_command=$1
|
||||||
|
}
|
||||||
|
notify-precmd() {
|
||||||
|
if ! [[ -z $notify_command_start ]]; then
|
||||||
|
local notify_command_end=`date +%s`
|
||||||
|
local notify_command_time=$(($notify_command_end - $notify_command_start))
|
||||||
|
if [[ $notify_command_time -gt $notify_command_threshold ]]; then
|
||||||
|
notify "completed: $notify_command"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
add-zsh-hook preexec notify-preexec
|
||||||
|
add-zsh-hook precmd notify-precmd
|
||||||
|
|
||||||
# Detect the type and extract an archive file.
|
# Detect the type and extract an archive file.
|
||||||
extract() {
|
extract() {
|
||||||
if [ -f $1 ]; then
|
if [ -f $1 ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user