add xclip support for clipboard copy and paste functions

This commit is contained in:
kewl fft 2018-06-02 21:53:02 +01:00 committed by Fabian Homborg
parent 56198818b0
commit ebc5e18956
2 changed files with 6 additions and 0 deletions

View file

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

View file

@ -9,6 +9,10 @@ function fish_clipboard_paste
if not set data (xsel --clipboard 2>/dev/null)
return 1
end
else if type -q xclip
if not set data (xclip -selection clipboard -o 2>/dev/null)
return 1
end
end
# Also split on \r to turn it into a newline,
# otherwise the output looks really confusing.