mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 03:03:57 +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)
|
test -n "$cmdline"; or set cmdline (commandline)
|
||||||
if type -q pbcopy
|
if type -q pbcopy
|
||||||
printf '%s\n' $cmdline | 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
|
else if type -q xsel
|
||||||
# Silence error so no error message shows up
|
# Silence error so no error message shows up
|
||||||
# if e.g. X isn't running.
|
# if e.g. X isn't running.
|
||||||
printf '%s\n' $cmdline | xsel --clipboard 2>/dev/null
|
printf '%s\n' $cmdline | xsel --clipboard 2>/dev/null
|
||||||
else if type -q xclip
|
else if type -q xclip
|
||||||
printf '%s\n' $cmdline | xclip -selection clipboard 2>/dev/null
|
printf '%s\n' $cmdline | xclip -selection clipboard 2>/dev/null
|
||||||
else if type -q wl-copy
|
|
||||||
printf '%s\n' $cmdline | wl-copy
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,8 @@ function fish_clipboard_paste
|
||||||
set -l data
|
set -l data
|
||||||
if type -q pbpaste
|
if type -q pbpaste
|
||||||
set data (pbpaste)
|
set data (pbpaste)
|
||||||
|
else if set -q WAYLAND_DISPLAY; and type -q wl-paste
|
||||||
|
set data (wl-paste)
|
||||||
else if type -q xsel
|
else if type -q xsel
|
||||||
# Return if `xsel` failed.
|
# Return if `xsel` failed.
|
||||||
# That way 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.
|
||||||
|
@ -13,8 +15,6 @@ function fish_clipboard_paste
|
||||||
if not set data (xclip -selection clipboard -o 2>/dev/null)
|
if not set data (xclip -selection clipboard -o 2>/dev/null)
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
else if type -q wl-paste
|
|
||||||
set data (wl-paste)
|
|
||||||
end
|
end
|
||||||
# Also split on \r to turn it into a newline,
|
# Also split on \r to turn it into a newline,
|
||||||
# otherwise the output looks really confusing.
|
# otherwise the output looks really confusing.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user