From c558113a0c9bbd303b9ade2c81c5c79121700b90 Mon Sep 17 00:00:00 2001 From: Warren Spits Date: Thu, 16 Jun 2016 22:49:31 +1000 Subject: [PATCH] Check for $DISPLAY environment variable for xsel and xclip --- scripts/helpers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/helpers.sh b/scripts/helpers.sh index 88fff4f..ca7e5f8 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -110,10 +110,10 @@ clipboard_copy_command() { else echo "pbcopy" fi - elif command_exists "xclip"; then + elif [ -n "$DISPLAY" ] && command_exists "xclip"; then local xclip_selection="$(yank_selection)" echo "xclip -selection $xclip_selection" - elif command_exists "xsel"; then + elif [ -n "$DISPLAY" ] && command_exists "xsel"; then local xsel_selection="$(yank_selection)" echo "xsel -i --$xsel_selection" elif command_exists "putclip"; then # cygwin clipboard command