From: Mark Wooding Date: Tue, 21 Apr 2020 12:03:58 +0000 (+0100) Subject: bin/wakey.zsh: Use the new hook machinery to insinuate. X-Git-Url: https://git.distorted.org.uk/~mdw/profile/commitdiff_plain/05e32650ff10d5b6977c6c023a7bca5c21b9ed96 bin/wakey.zsh: Use the new hook machinery to insinuate. --- diff --git a/bin/wakey.zsh b/bin/wakey.zsh index bb6e908..6f008a9 100644 --- a/bin/wakey.zsh +++ b/bin/wakey.zsh @@ -60,12 +60,12 @@ __wakey_precmd () { esac } -case ${DISPLAY-nil},${WINDOWID-nil} in - nil,* | *,nil) ;; +case ${DISPLAY+t},${WINDOWID+t},${__mdw_precmd_hook+t},${mdw__preexec_hook+t} in + t,t,t,t) ;; *) - if whence notify-send >/dev/null 2>&1; then - preexec_functions+=(__wakey_preexec) - precmd_functions+=(__wakey_precmd) + if __mdw_programp notify-send ; then + __mdw_addhook __mdw_preexec_hook __wakey_preexec + __mdw_addhook __mdw_precmd_hook __wakey_precmd fi ;; esac