Silence xsel errors

Fixes #4923.

[ci skip]
This commit is contained in:
Fabian Homborg 2018-04-25 23:10:58 +02:00
parent f3f2d2d191
commit 2fd15e7c6c
2 changed files with 5 additions and 4 deletions

View file

@ -2,6 +2,8 @@ function fish_clipboard_copy
if type -q pbcopy
commandline | pbcopy
else if type -q xsel
commandline | xsel --clipboard
# Silence error so no error message shows up
# if e.g. X isn't running.
commandline | xsel --clipboard 2>/dev/null
end
end

View file

@ -4,10 +4,9 @@ function fish_clipboard_paste
set data (pbpaste)
else if type -q xsel
# Return if `xsel` failed.
# 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.
# That way we don't print the redundant (and overly verbose for this) commandline error.
# Also require non-empty contents to not clear the buffer.
if not set data (xsel --clipboard)
if not set data (xsel --clipboard 2>/dev/null)
return 1
end
end