From 422ff0f173fd9d00149bd1e6b5d82c74c2330eef Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 28 Nov 2016 10:09:58 +0100 Subject: [PATCH] Don't paste if xsel fails This silences a rather verbose error. --- share/functions/fish_clipboard_paste.fish | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/functions/fish_clipboard_paste.fish b/share/functions/fish_clipboard_paste.fish index 7be522291..dc95e41d6 100644 --- a/share/functions/fish_clipboard_paste.fish +++ b/share/functions/fish_clipboard_paste.fish @@ -2,6 +2,11 @@ function fish_clipboard_paste if type -q pbpaste commandline -i -- (pbpaste) else if type -q xsel - commandline -i -- (xsel --clipboard) + # Only run `commandline` if `xsel` succeeded. + # That way any xsel error is printed (to show e.g. a non-functioning X connection), + # but we don't print the redundant (and overly verbose for this) commandline error. + if set -l data (xsel --clipboard) + commandline -i -- $data + end end end