From 7906e2b131d29e177fa5994aabf5756dfebc5740 Mon Sep 17 00:00:00 2001 From: Alexey Samoshkin Date: Fri, 24 Nov 2017 16:55:17 +0200 Subject: [PATCH] Copy into primary and clipboard buffers on Linux using xclip --- tmux/yank.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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