chiark / gitweb /
bin/wakey.zsh: Don't do anything if there's no X display, or `notify-send'.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 20 Apr 2020 12:14:23 +0000 (13:14 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 20 Apr 2020 12:24:52 +0000 (13:24 +0100)
bin/wakey.zsh

index 41ccafd9561367475617840ca2c15575e6d220bf..94638caa84ebad8518ae2e252fb17671bc1fb99d 100644 (file)
@@ -40,5 +40,12 @@ __wakey_precmd () {
   esac
 }
 
-preexec_functions+=(__wakey_preexec)
-precmd_functions+=(__wakey_precmd)
+case ${DISPLAY-nil} in
+  nil) ;;
+  *)
+    if whence notify-send >/dev/null 2>&1; then
+      preexec_functions+=(__wakey_preexec)
+      precmd_functions+=(__wakey_precmd)
+    fi
+    ;;
+esac