Skip to content

Commit

Permalink
Copy into primary and clipboard buffers on Linux using xclip
Browse files Browse the repository at this point in the history
  • Loading branch information
samoshkin committed Nov 24, 2017
1 parent 9c6d5f7 commit 7906e2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tmux/yank.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7906e2b

Please sign in to comment.