CrispyConductor / tmux-copy-toolkit

TMUX plugin with various copy-mode tools
MIT License
59 stars 6 forks source link

Can I copy to clipboard? #5

Closed jaehyung-ca closed 3 years ago

jaehyung-ca commented 3 years ago

Hi there,

First, thank you for the awesome plugin.

Is there a way to copy Tmux buffer to a clipboard with your plugin? I'm using Tmux v3.0a on Ubuntu 20.04.

I could do it on Tmux copy-mode by set .tmux.conf like this. bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' But it does not work with your plugin.

CrispyConductor commented 3 years ago

Thanks for the encouragement!

You can do the same kind of thing with copytk using the @copytk-copy-command option; it just defaults to tmux load-buffer -, but can also be set to use xclip in the same way. If you'd like to send it to both xclip and to a tmux buffer, it just takes a short shell script to read stdin and invoke both. A little while back I wrote a blog post about multi-way synchronization, but it may be more than what you're looking for.

jaehyung-ca commented 3 years ago

I tried a few things, but nothing worked.

echo 'test' | xclip -selection c echo 'test' | tmux load-buffer - ; tmux save-buffer - | xclip -selection c both work, but set -g @copytk-copy-command "xclip -selection c" set -g @copytk-copy-command "tmux load-buffer -; tmux save-buffer - | xclip -selection c" do not work.

I logged every step inside the runshellcommand and the program is stuck in the recvstdout, _ = proc.communicate(input=sendstdin)

So, I have no idea.

CrispyConductor commented 3 years ago

Fixed by PR #6 . Thanks jaehyung-ca!