From 0b69235c37663429003691a815b78c645d42f783 Mon Sep 17 00:00:00 2001 Message-Id: <0b69235c37663429003691a815b78c645d42f783.1717627293.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 20 Apr 2020 13:14:23 +0100 Subject: [PATCH] bin/wakey.zsh: Don't do anything if there's no X display, or `notify-send'. Organization: Straylight/Edgeware From: Mark Wooding --- bin/wakey.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/wakey.zsh b/bin/wakey.zsh index 41ccafd..94638ca 100644 --- a/bin/wakey.zsh +++ b/bin/wakey.zsh @@ -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 -- [mdw]