Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yank to clipboard using xsel doesn't work #126

Open
hensz opened this issue Jul 22, 2019 · 15 comments
Open

yank to clipboard using xsel doesn't work #126

hensz opened this issue Jul 22, 2019 · 15 comments

Comments

@hensz
Copy link

hensz commented Jul 22, 2019

Hi!
I run tmux with tmux-yank via x-forwarding on Windows, don't know if this is related. At least using xsel works fine: echo "foo" | xsel -b results in having "foo" in the system clipboard, accessible both from Linux and Windows.

However when copying from tmux by either using the mouse (with mouse-mode on) or by using the copy mode, the selection is always put in the PRIMARY clipboard, where I can paste it by using + ].

I tried using @override_copy_command or custom_copy_command, setting both to xsel -b, but with no effect. Also I set yank_selection_mouse to clipboard, which also has no effect. Am I doing something wrong?

Thanks,
Torsten

@wizonesolutions
Copy link

@hensz Have you found a workaround for this? I can work around it by pressing y while holding the mouse button down, but it's annoying to hold the mouse button down. But disabling auto-yank on mouseup doesn't work either...it ignores the setting.

@hensz
Copy link
Author

hensz commented Aug 12, 2019

Hi!
The workaround I currently use is holding SHIFT while selection - this disables tmux copy mode and uses the regular Linux copy mode. I can live with this, however I still want to know why the way I want to use doesn't work. Is this a bug, or am I doing somethign wrong here?

@ebkalderon
Copy link

Another user chiming in. It doesn't seem to work with xclip either. I can confirm that the workaround by @hensz works on my machine too, but at that point, there is no reason to use tmux-yank. For context, I'm running a very recent Arch Linux with tmux version 2.9a.

@CollinChaffin
Copy link

Same here. Running PhotonOS v3 which doesn't support xclip, xsel, or pbcopy so was hoping the ESC sequences (which I thought was the original magic behind this) would be my one option. Alas, this plugin still does not transfer anything to the clipboard.

@hensz
Copy link
Author

hensz commented Oct 21, 2019

Hi there!
Does no one have any clue what causes the issue? Since tmux-yank explicitly supports pasting to the system clipboard it should be possible to get it to work - but how, with which settings?
Any help is appreciated. If you need further information e.g. logs or whatever, I'm happy to provide this.
Thanks,
Torsten

@hensz
Copy link
Author

hensz commented Dec 13, 2019

So while I can live with the workaround, using Shift+select, I still like to use the built-in copy&paste functionality of tmux to copy into the clipboard. Since this is not working with tmux-yank, is someone aware of an alternative way to do this, e.g. with a different plugin?

@hensz
Copy link
Author

hensz commented Jan 16, 2020

Is someone reading this? As three user already mentioned, tmux-yank seems to be useless of this is a general issue. Or does anyone see this different?

@urey-hiker
Copy link

Is someone reading this? As three user already mentioned, tmux-yank seems to be useless of this is a general issue. Or does anyone see this different?

maybe we should use the origin tmux way to do the samething.
https://unix.stackexchange.com/a/131187

@hensz
Copy link
Author

hensz commented Apr 28, 2020

There are several suggestions in this thread. I tried a few, but none worked for me. Since I'm not really familiar with Linux clipboard, I don't understand much from these threads and can only copy&paste without understanding what actually is going on here.

Nevertheless, there's this extension, tmux-yank, which should solve exactly this problem, yanking to clipboard, but in fact it doesn't.

@urey-hiker
Copy link

There are several suggestions in this thread. I tried a few, but none worked for me. Since I'm not really familiar with Linux clipboard, I don't understand much from these threads and can only copy&paste without understanding what actually is going on here.

Nevertheless, there's this extension, tmux-yank, which should solve exactly this problem, yanking to clipboard, but in fact it doesn't.

My tmux work fine with xsel with this configure in tmux.conf:
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xsel -i -b'
My tmux version is 3.1 and this configure should work in tmux version > 2.5
It works the way exactly as tmux-yank, so also check you disable the old run tmux-yank configure.
I put my tmux.conf here, you may compare it with yours.

@hensz
Copy link
Author

hensz commented May 5, 2020

Nope, doesn't work. Since I suspected xsel to behave strange I tested this:
echo foo | xsel -ib

This does nothing, the clipboard content (which I then paste with Ctrl+Insert) is still unchanged.

However, when I run xsel with -ip (primary instead of clipboard) pasting with both Ctrl+Insert and middle mouse click pasted "foo\n" -- sadly with a trailing newline, but better than nothing.

So I modified you config entry from xsel -i -b to xsel -ip, just as on the command line. But no luck, pasting doesn't work.

Is there a way to diagnose why this doesn't work? Since currently I don't see where things go wrong. Is it the hook for copy-mode-vi, is it send-keys, is it the copy-pipe-and-cancel event or the xsel command?

@hensz
Copy link
Author

hensz commented Aug 20, 2020

I also now tried tmux 3, but the result is nearly identical. The only difference is: With tmux 3 the command xsel -ib works as expected - but only when run from command line, but not together with tmux-yank.

Has anyone ever managed to get copying to the clipboard to work? If yes, how?

@hensz
Copy link
Author

hensz commented Oct 23, 2020

Still no update... :-(

@mraxilus
Copy link

I take it that this project is abandoned? It would've been really useful...

@hensz
Copy link
Author

hensz commented Nov 7, 2023

Since we don't use x-forwarding anymore (for reasons), xsel and xclip doesn't work at all. Thus, this issue is not relevant for me anymore, so from my perspective the issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants