diff --git a/tmux/yank.sh b/tmux/yank.sh index f2a0e86..3f96d73 100755 --- a/tmux/yank.sh +++ b/tmux/yank.sh @@ -15,15 +15,15 @@ if is_app_installed pbcopy; then copy_backend="pbcopy" elif is_app_installed reattach-to-user-namespace; then copy_backend="reattach-to-user-namespace pbcopy" -elif [ -n "${DISPLAY-}" ] && is_app_installed xclip; then - copy_backend="xclip -selection clipboard -i" elif [ -n "${DISPLAY-}" ] && is_app_installed xsel; then copy_backend="xsel -i --clipboard" +elif [ -n "${DISPLAY-}" ] && is_app_installed xclip; then + copy_backend="xclip -i -f -selection primary | xclip -i -selection clipboard" fi # if copy backend is resolved, copy and exit if [ -n "$copy_backend" ]; then - printf "$buf" | "$copy_backend" + eval "printf '$buf' | $copy_backend" exit; fi