mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 08:10:24 +08:00
fish_clipboard_{copy,paste}: only use xsel/xclip if $DISPLAY is set
Ubuntu's fish package on WSL 1 has xsel as recommended dependency, even though there is no X server available. This change makes us use Windows' native clipboard even when xsel is installed.
This commit is contained in:
parent
938879a85a
commit
72fd328ad2
@ -6,12 +6,10 @@ function fish_clipboard_copy
|
||||
printf '%s' $cmdline | pbcopy
|
||||
else if set -q WAYLAND_DISPLAY; and type -q wl-copy
|
||||
printf '%s' $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' $cmdline | xsel --clipboard 2>/dev/null
|
||||
else if type -q xclip
|
||||
printf '%s' $cmdline | xclip -selection clipboard 2>/dev/null
|
||||
else if set -q DISPLAY; and type -q xsel
|
||||
printf '%s' $cmdline | xsel --clipboard
|
||||
else if set -q DISPLAY; and type -q xclip
|
||||
printf '%s' $cmdline | xclip -selection clipboard
|
||||
else if type -q clip.exe
|
||||
printf '%s' $cmdline | clip.exe
|
||||
end
|
||||
|
@ -4,10 +4,10 @@ function fish_clipboard_paste
|
||||
set data (pbpaste 2>/dev/null)
|
||||
else if set -q WAYLAND_DISPLAY; and type -q wl-paste
|
||||
set data (wl-paste 2>/dev/null)
|
||||
else if type -q xsel
|
||||
set data (xsel --clipboard 2>/dev/null)
|
||||
else if type -q xclip
|
||||
set data (xclip -selection clipboard -o 2>/dev/null)
|
||||
else if set -q DISPLAY; and type -q xsel
|
||||
set data (xsel --clipboard)
|
||||
else if set -q DISPLAY; and type -q xclip
|
||||
set data (xclip -selection clipboard -o)
|
||||
else if type -q powershell.exe
|
||||
set data (powershell.exe Get-Clipboard | string trim -r -c \r)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user