Always use wl-{copy,paste} if running on wayland

This commit is contained in:
Johannes Altmanninger 2019-10-24 11:41:16 +02:00
parent 4fbc6cd3f8
commit 0a5c2051b1
2 changed files with 4 additions and 4 deletions

View File

@ -4,13 +4,13 @@ function fish_clipboard_copy
test -n "$cmdline"; or set cmdline (commandline)
if type -q pbcopy
printf '%s\n' $cmdline | pbcopy
else if set -q WAYLAND_DISPLAY; and type -q wl-copy
printf '%s\n' $cmdline | wl-copy
else if type -q xsel
# Silence error so no error message shows up
# if e.g. X isn't running.
printf '%s\n' $cmdline | xsel --clipboard 2>/dev/null
else if type -q xclip
printf '%s\n' $cmdline | xclip -selection clipboard 2>/dev/null
else if type -q wl-copy
printf '%s\n' $cmdline | wl-copy
end
end

View File

@ -2,6 +2,8 @@ function fish_clipboard_paste
set -l data
if type -q pbpaste
set data (pbpaste)
else if set -q WAYLAND_DISPLAY; and type -q wl-paste
set data (wl-paste)
else if type -q xsel
# Return if `xsel` failed.
# That way we don't print the redundant (and overly verbose for this) commandline error.
@ -13,8 +15,6 @@ function fish_clipboard_paste
if not set data (xclip -selection clipboard -o 2>/dev/null)
return 1
end
else if type -q wl-paste
set data (wl-paste)
end
# Also split on \r to turn it into a newline,
# otherwise the output looks really confusing.