1
0
mirror of https://github.com/samoshkin/tmux-config.git synced 2026-01-03 00:08:01 +00:00

Copy into primary and clipboard buffers on Linux using xclip

This commit is contained in:
Alexey Samoshkin
2017-11-24 16:55:17 +02:00
parent 9c6d5f7e1c
commit 7906e2b131

View File

@@ -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