tmux-yank
tmux-yank copied to clipboard
linux, xsel: Primary paste in the tmux window doesn't work immediately
With set -g mouse on, when I highlight text tmux-yank copies it to the primary buffer using xsel. When I immediately try to paste this text in any pane (using shift+middle-click) in the same tmux instance it fails to paste. xsel -p prints the previously highlighted text - so the copy part is working, just paste isn't.
If I middle-click into any other window, the paste works. And from then on, the paste also works in tmux. This suggests to me that there is something blocking the shift-middle-click paste in tmux, until the terminal window loses focus. Copy/primary-paste continues to work for a short time after this, then it happens again (after ~2 mins).
This happens in fullscreen or windowed mode and seems to also apply to the clipboard buffer (when text is copied by pressing "y" instead of mouse-up).
I'm aware I can just bypass tmux by holding down Alt, but this doesn't work with panes as it selects a whole line across the display. I'd like to copy multi-line per pane.
I'm not sure how to debug the middle-click paste event in tmux. What debug options can I turn on to print more information about this? Thanks
tmux 2.9a, Fedora 32, gnome-terminal 3.34.2
I can reproduce this faster with the following sequence:
- Shift-highlight, to bypass (un-focus?) tmux and copy text to primary buffer
- Shift-middle-click, to paste primary buffer into tmux
- Normal "mouse on" highlight, to tmux-yank copy text to primary buffer (works)
- Shift-middle-click, to paste primary buffer into tmux (does not work)
I can paste the primary buffer selected in 3 into another terminal. After this the paste works again in the first tmux/gnome-terminal instance.
Another quick workaround is to highlight text and mouse-up (copying to primary clipboard), then press the super-key (Windows key) twice. In Gnome 3, this enters and leaves the "Activities" overview (I think that's what it's called) - re-focusing the terminal and letting me paste with middle-click.
I think the next steps to debug this are:
- Reproducing on another machine/os (maybe it's just me?)
- Reproduce with upstream tmux
- Add debug to upstream tmux mouse-up and middle-click events
- Add debug to "paste" action - if that's even a thing.
Hopefully someone with more knowledge of tmux can point me in the right direction.
I use mobaxterm on win10 locally ,ssh to remote ubuntu 20.04, run in tmux.
Yank is quite slow too.
Look forward to improvement.
Thx!