-
-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
forward clipboard read osc sequence #2647
Comments
#2637, opened 5 days earlier, is closely related to this. Having the ability to paste into a Zellij session would be very helpful for those of us who "literally live in the remote session." |
osc is a clipboard tool for the modern age, since August is explicitly excluding Zellij due to incompatibility - links to this issue on the README.md page. This is a shame, as this is the only non-server based clipboard stdin/stdout app I've found. If no one can spare the time to take a look at it, I would appricate some guidance at to how this would be tackled. Some general pointers, and I'd be willing to attempt a PR for this. |
Zellij intentionally does not support the Why? Think about everything you're copying to your clipboard (intentionally or unintentionally through just marking it in some DEs). Now imagine anything you run through your terminal (intentionally or unintentionally) would be able to read this clipboard without you even noticing it happened. Would you be comfortable with that? Neither would I. I'm so uncomfortable with it that I don't even want software that I maintain to have this ability. I realize this can be very convenient and empathize with users who want this, but this is IMO too reckless to have in any sort of terminal. I might consider adding it behind a user visible prompt (eg. |
Chiming in here since I've been looking forward to this too for a while. To preface, I have been daily driving with zellij at work since its release, and it has replaced (almost all of) tmux for and I don't see myself ever going back. (I also use neovim with clipboard='unnamedplus'). I use zellij through remote ssh sessions at work, and the lack of support for the paste event is an area where I still encounter some friction (albeit, a small amount) in daily work. When swapping between many zellij tabs with neovim open in all of them, copying text between them is simple (just yank to the system clipboard). However, when pasting text between them, I have to remember to paste not with Based on discussion in other issues (#2637 #3135), the first workaround is to use neovim's built-in OSC52 clipboard (as of 0.10.0). However, if you try to paste with I agree this functionality should not be left on by default but having it at least as an option makes sense to me. If it is on, there could be the user visible prompt like you mentioned (on by default, and can be turned off). I believe ghostty already has something like this called clipboard-paste-protection. |
Good to hear from one of the Zellij elders :) I'm happy to accept a contribution for this with the pop-up. I would encourage anyone interested in implementing this to consult me first, as I'd like to have the pop-up implemented as a custom built-in |
Ghostty and Kitty both have this as an option, yeah -- "reject paste", "prompt user on every paste", or "always paste". tmux is somewhat different here (and osc's support for it is correspondingly complicated). On OSC52 paste, it will (depending on configuration) ignore it, forward the sequence to the client, or forward to the client and set one of its internal paste buffers. On OSC52 paste, it will always paste from its internal buffers and never forward the request to the client. osc handles this by wrapping the copy command in a tmux passthrough sequence, allowing it to go straight to the host without touching tmux's paste buffers, and then on paste, calling This does seem to contradict the osc documentation -- it doesn't look like it needs At any rate, this is a source of some recurring confusion when trying to use OSC52 with tmux, because even if everything is configured "right", you'll end up copying into your local clipboard and the tmux clipboard, but only ever pasting from the tmux clipboard, which is fine for copy-paste within a tmux session but doesn't do what you want if you're trying to copy from something else into it; and the workaround is to explicitly run |
I can totally understand the security implications. However, adding a notification every time something needs to read the clipboard through OSC adds friction and an unnecessary extra step in an environment where the main draw is speed and efficiency. Instead, making the feature (OPT-IN) with a giant disclaimer in the docs is a suitable middle ground. Putting the power in the hands of the user, given that the user is suitably informed, is never a bad thing. |
I'm happy to add a "never show again" checkbox to said pop-up. But for the record, while I think allowing the user to do this with giant warnings is good to remove the responsibility from the maintainers, it's still a terrible idea from the user's perspective. I'm honestly a bit surprised we haven't seen more attacks from this vector, but I have a feeling we will in the future. Anyway, just my opinion. Since many terminals support this without even showing any pop-up or warning, it won't be the end of the world if we do it this way. |
It appears that reading the clipboard via osc is not supported yet. Can it be added? Many terminals have added support for this, either by default (e.g. alacritty) or gated behind a config option (iterm2, kitty). Passing through the clipboard read command and allowing the terminal to handle/reject seems like it would be useful.
The text was updated successfully, but these errors were encountered: