diff --git a/share/functions/fish_clipboard_copy.fish b/share/functions/fish_clipboard_copy.fish index 0054198aa..47fa8264a 100644 --- a/share/functions/fish_clipboard_copy.fish +++ b/share/functions/fish_clipboard_copy.fish @@ -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 diff --git a/share/functions/fish_clipboard_paste.fish b/share/functions/fish_clipboard_paste.fish index 54c78d445..0ed27abce 100644 --- a/share/functions/fish_clipboard_paste.fish +++ b/share/functions/fish_clipboard_paste.fish @@ -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.