You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Reacted by Ada, hardfault, Jared Baur, name_snrl, Ismael Puerto, Jinhao Li, Trevor Gross, Xavier Ruiz, iforapsy, flatmapthatshit and 22 more
#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 paste part of OSC52, just the copy part.
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. program <X> wants to read this text <TEXT> from your clipboard, allow? (y/n))
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 p or P, but with cmd-v. Sometimes I still paste with p out of habit and have to undo the paste and paste again. This can be particularly annoying when I meant to paste over selected text and I forget that I can't use p, so I have to reselect what I wanted to paste over again.
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 p, neovim will stall with Waiting for OSC 52 response from the terminal. Press Ctrl-C to interrupt... before timing out (since paste event is unsupported by zellij). So I have found the actual workaround is to use the nvim-osc52 plugin, which gives the functionality in my earlier example (copy with yank, paste with cmd-v). One thing to note is this plugin links to the osc page that has a table comparing osc functionality between different terminal multiplexers). zellij is the only one that does not support the paste event (with a link to this issue). (This is one of the only things I still miss from tmux)
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.
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 notification plugin (so that we can also use it for other stuff and allow users to swap it for custom implementations).
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.
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 tmux refresh-client -l to request the clipboard from the client -- at which point it's up to the client terminal what it does (e.g. prompt the user if using ghostty/kitty, unconditionally reject if using konsole, etc).
This does seem to contradict the osc documentation -- it doesn't look like it needs set-clipboard permission -- but possibly there's some subtlety there I'm missing.
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 tmux refresh-client -l before each paste, which requires special tmux handling in every program. :(
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.
Reacted by Gal Szkolnik, Mike, Kirill Pertsev and jung
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.
Reacted by John Antoine, Mike, gitmpr, Jalil David Salamé Messina, Bogdan and Nic
" Fake system clipboard using a temp file to make y of nvim working
let g:clipboard = {
\ 'name': 'fake-clipboard',
\ 'copy': {
\ '+': ['tee', '/tmp/nvim-clipboard'],
\ '*': ['tee', '/tmp/nvim-clipboard'],
\ },
\ 'paste': {
\ '+': ['cat', '/tmp/nvim-clipboard'],
\ '*': ['cat', '/tmp/nvim-clipboard'],
\ },
\ 'cache_enabled': 0,
\ }
" copy text to real system clipboard
autocmd TextYankPost *
\ if v:event.regname is "" |
\ execute 'OSCYankRegister "' |
\ endif
The only problem now is that it's impossible to read the content from the real system clipboard by p in nvim.
As someone who prefers the convenience over the security I'd love for this to become a configurable option. Perhaps upon the first time the terminal tries to paste, Zellij opens a prompt where you can decide to
Approve now (pops up again later)
Deny now (pops up again later
Approve forever
Deny forever (default)
And there could be a warning at the bottom stating that approving forever has security implications
Reacted by Heechul Ryu, nikbabu, Alex Lu, Sirius902 and Hugo Ruíz
I hope this can be re-visited. At the very least, the ability to simply pass through OSC 52 copy requests to the terminal would suffice for me. Ghostty by default prompts you to allow/deny:
I think allowing the user to explicitly opt in to allowing their terminal to handle it should be permitted. Add a warning in the docs explaining the danger, and let the user make their own decision.
Reacted by Heechul Ryu, Jalil David Salamé Messina, Diana, Sirius902, Tubbles and Hugo Ruíz
I implemented opt-in support for reading the paste buffer (assuming the host terminal itself supports it) under a new dangerously_enable_paste_buffer_read true in the config (defaulting to false): #5472
At the time of writing still unreleased. Follow the project on github if you'd like to be notified when this is released.
Reacted by CJ van den Berg, Heechul Ryu, yrammos and Gal Szkolnik
Reacted by Anafabula, Heechul Ryu and Gal Szkolnik
Activity
whmountains commentedon Jun 25, 2024
#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."
Lockszmith-GH commentedon Dec 10, 2024
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.
imsnif commentedon Jan 17, 2025
Zellij intentionally does not support the
pastepart of OSC52, just the copy part.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.
program <X> wants to read this text <TEXT> from your clipboard, allow? (y/n))j4shu commentedon Jan 17, 2025
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
porP, but withcmd-v. Sometimes I still paste withpout of habit and have to undo the paste and paste again. This can be particularly annoying when I meant to paste over selected text and I forget that I can't usep, so I have to reselect what I wanted to paste over again.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
p, neovim will stall withWaiting for OSC 52 response from the terminal. Press Ctrl-C to interrupt...before timing out (since paste event is unsupported by zellij). So I have found the actual workaround is to use the nvim-osc52 plugin, which gives the functionality in my earlier example (copy with yank, paste withcmd-v). One thing to note is this plugin links to the osc page that has a table comparing osc functionality between different terminal multiplexers). zellij is the only one that does not support the paste event (with a link to this issue). (This is one of the only things I still miss from tmux)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.
imsnif commentedon Jan 17, 2025
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
notificationplugin (so that we can also use it for other stuff and allow users to swap it for custom implementations).ToxicFrog commentedon Jan 18, 2025
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
tmux refresh-client -lto request the clipboard from the client -- at which point it's up to the client terminal what it does (e.g. prompt the user if using ghostty/kitty, unconditionally reject if using konsole, etc).This does seem to contradict the osc documentation -- it doesn't look like it needs
set-clipboardpermission -- but possibly there's some subtlety there I'm missing.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
tmux refresh-client -lbefore each paste, which requires special tmux handling in every program. :(JohnAntoine commentedon Feb 5, 2025
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.
imsnif commentedon Feb 5, 2025
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.
neurocyte commentedon Nov 7, 2025
The secure option for supporting OSC52 paste is to only accept OSC52 clipboard requests directly after some other known good user input event.
So basically, if you send a
ctrl+vevent to the application, start a short timer (<150ms or so) and enable OSC52 paste requests until it expires.Obviously the event and the timeout should likely be configurable.
Revert "osc52": zellij-org/zellij#2647
nic-6443 commentedon Feb 4, 2026
Thank you to the developers for paying attention to this issue. This is also a problem that has been troubling me since I switched from tmux to zellij. Currently, I use https://github.com/ojroques/vim-oscyank combined with a fake clipboard based on temporary files to bypass this issue, for everyone's reference:
The only problem now is that it's impossible to read the content from the real system clipboard by
pin nvim.ygypt commentedon Feb 6, 2026
As someone who prefers the convenience over the security I'd love for this to become a configurable option. Perhaps upon the first time the terminal tries to paste, Zellij opens a prompt where you can decide to
And there could be a warning at the bottom stating that approving forever has security implications
b0o commentedon Mar 27, 2026
I hope this can be re-visited. At the very least, the ability to simply pass through OSC 52 copy requests to the terminal would suffice for me. Ghostty by default prompts you to allow/deny:
I think allowing the user to explicitly opt in to allowing their terminal to handle it should be permitted. Add a warning in the docs explaining the danger, and let the user make their own decision.
yrammos commentedon Jul 11, 2026
Too bad zellij is not supporting this. The security risks can be mitigated with optional user-adjustable warnings, set to "on" by default.
fix(clipboard): answer OSC52 clipboard queries
imsnif commentedon Aug 13, 2026
I implemented opt-in support for reading the paste buffer (assuming the host terminal itself supports it) under a new
dangerously_enable_paste_buffer_read truein the config (defaulting to false): #5472At the time of writing still unreleased. Follow the project on github if you'd like to be notified when this is released.