ef8e63a7fd30e04079e54ea76043c1db76e24ddf

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(lib): prefer `xsel` over `xclip` in clipboard.zsh

See #10925

Diff

 1diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh
 2index aab21a28a502c14f93f2e1adacfbe72c85f83e96..ad83fc4b2d21c1fcf0068ca6313b8b4f46e6a80c 100644
 3--- a/lib/clipboard.zsh
 4+++ b/lib/clipboard.zsh
 5@@ -10,8 +10,8 @@
 6 # - pbcopy, pbpaste (macOS)
 7 # - cygwin (Windows running Cygwin)
 8 # - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
 9-# - xclip (if $DISPLAY is set)
10 # - xsel (if $DISPLAY is set)
11+# - xclip (if $DISPLAY is set)
12 # - lemonade (for SSH) https://github.com/pocke/lemonade
13 # - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
14 # - win32yank (Windows)
15@@ -60,12 +60,12 @@ function detect-clipboard() {
16   elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
17     function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
18     function clippaste() { wl-paste; }
19-  elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
20-    function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; }
21-    function clippaste() { xclip -out -selection clipboard; }
22   elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
23     function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; }
24     function clippaste() { xsel --clipboard --output; }
25+  elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
26+    function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; }
27+    function clippaste() { xclip -out -selection clipboard; }
28   elif (( ${+commands[lemonade]} )); then
29     function clipcopy() { cat "${1:-/dev/stdin}" | lemonade copy; }
30     function clippaste() { lemonade paste; }