mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 16:10:12 +08:00
Always use wl-{copy,paste} if running on wayland
This commit is contained in:
parent
4fbc6cd3f8
commit
0a5c2051b1
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user