chiark / gitweb /
bin/wakey.zsh: Use the new hook machinery to insinuate.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 21 Apr 2020 12:03:58 +0000 (13:03 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 21 Apr 2020 12:03:58 +0000 (13:03 +0100)
bin/wakey.zsh

index bb6e9087be5985d2cc9dea4e07239233e9d5e567..6f008a9930616a976d61ea9bcaf81a7631460e3e 100644 (file)
@@ -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