GeezerVison is showing github.com — Copy and Paste behaviour under Linux · Issue #4754 · anomalyco/opencode
Copy and Paste behaviour under Linux #4754DescriptionDescription
Background
You might be aware that Linux famously has two copy and paste buffers. It's a bit annoying but generally speaking I'm used to it.
I can paste into my terminal using my mouse in one of two ways;
- I can middle click and paste automatically happens (call this buffer 1)
- I can right click and select paste from the menu (call this buffer 2)
As you can see each of these two ways uses a different buffer.
First issue
Because OpenCode does something to disable my right click menu; I am unable to paste from buffer 2 into OpenCode.
It's a bit annoying. I've found myself having to paste things into a GUI text editor from buffer 2, then copy them into buffer 1 so I can middle click paste them into opencode. It's a lot of extra clicks just to copy and paste.
Second issue
When highlight text, it is automatically copied to my clipboard.
Linux already has this feature built in.. By default when I highlight things in my terminal they are automatically copied in to buffer 1.
Open Code actually copies the text into buffer 2.
On the face of it, it's not a big issue because every other app lets me paste from either buffer.
However when I want to copy from OpenCode and then paste back into OpenCode, because I'm trying to repeat back a small bit of text ... I can't, because the copy goes into buffer 2, and I'm only able to paste from buffer 1.
Suggested Fix
I wonder if perhaps we could not disable the right click menu?
Or perhaps there could be an option to disable the mouse integration? I never use that anyway.
Alternatively; change how the copy and paste works. I don't know enough to make suggestions around that however.
OpenCode version
v0.1.50 (currently the latest)
Terminal
Tillix and tmux Reacted by Pavel Snajdr, Mauricio Scheffer, Darko Luketic, Chad Hirsch, Christopher Carroll Smith, Gardner Bickford, Steve Schmerler, UncleJS, Oliver Valls, dennisaschmidt and 8 more Activitygithub-actions commented on Nov 25, 2025 This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case. Reacted by Brian Wojtczak and Kyle Baker astrolox commented on Nov 26, 2025 Not an exact duplicate of any of those; but they are all relevant in some way. rekram1-node commented on Nov 26, 2025 @astrolox could we mark this as a dup of #3684?
Seems like they are asking for same thing since u said:
I wonder if perhaps we could not disable the right click menu?
I don't think it's a matter of us disabling it I think it's just that since this is a TUI unlike some other tools, we need to implement some of these behaviors ourselves instead of being able to rely on your terminal taking care of it for us atkr commented on Nov 26, 2025 @astrolox parcellite can be quite useful if you are annoyed of having 2 separate buffers (it can automatically sync them and avoid the annoyance you described in the original comment) - I've been using it for 15+ years 😄 astrolox commented on Nov 26, 2025 I don't really know what the best solution is. I wanted to convey the problem specifically rather than a solution because you may know better than I.
The easiest thing would be the ability to disable mouse integration and let the terminal just handle all mouse interactions. In that way it is a duplicate.
For example copy text into the same buffer which you allow me to paste from. In that way my problem goes away and your tool is consistent with the default terminal behaviour. However I have no idea if that's even possible for you.
Implementing your own right click menu might be another avenue but would be a large task if done just for this problem. astrolox commented on Nov 26, 2025
parcellite can be quite useful if you are annoyed of having 2 separate buffers
I quite like having 2 now I'm used to it. However I need them to work consistently across multiple applications. That's really the crux of my bug report, opencode is inconsistent with everything else on my desktop in this regard. Reacted by Marno, Matt Mundell and Kyle Baker added a commit that references this issue on Dec 29, 2025This issue will close once commit acd3985 is merged into the 'dev' branch.acd3985 tbaumann commented on Jan 9, 2026 I really can't use this software if it's intentionally breaking my setup.
Proper copy and paste works in my terminal. (Select to copy, middle click to insert) This app broke this absolutely needlessly. Reacted by Zoff, Gert Burger, Jeremy Akers, Chad Hirsch, Marno, lsh-0, M B, TangerineNightmare and Matt Woodson erwinzierler commented on Jan 17, 2026 I am getting really frustrated too with the copy & paste behavior. I have followed the instructions in https://opencode.ai/docs/troubleshooting/#copypaste-not-working-on-linux and read https://opencode.ai/docs/keybinds/ but so far I have not been able to copy text into opencode. What's really funny is: pasting an image that's in my buffer works just fine with Ctrl+v. After reading this whole thread and a few more I am wondering if there are any plans to get this sorted out finally? I'd really hate having to give up this great tool just because basic functionality is missing. Reacted by summerjch, Gert Burger, Michał Nowakowski, Marno, Oliver Valls, M B and TangerineNightmare jeremyakers commented on Jan 24, 2026 How do you screw up something as basic as copy paste in a CLI tool?
Why do you disable the right click context menu at all? Plenty of other "visual" CLI tools work just fine with the bog standard copy paste options.
Looking at: https://opencode.ai/docs/troubleshooting/#copypaste-not-working-on-linux
Are you really telling me I have to run:
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
export DISPLAY=:99.0
If I want copy paste over an SSH connection?
in 30 years of developing on Linux environments I have never had to install and run a separate daemon for something as basic as copy paste. Reacted by Marno, Jaden, M B, TangerineNightmare and Eric Johnson MichaelBrenden commented on Mar 9, 2026 It is the most bizarre UI behavior I've ever seen, including across EAGLE PCB and PROTEL DOS; otherwise, the cli tool is stellar. Reacted by TangerineNightmare and Eric Johnson buzz commented on Mar 9, 2026 Pasting didn't work at all for me in OpenCode (using the kitty terminal emulator).
I dug into the code and noticed that OpenCode only handles image pasting internally. See the input_paste action. It silently ignores any pasted text.
It's a bit confusing that the action is called input_paste even though it doesn't paste text. Something like input_image_paste might be clearer…
As far as I can tell, text pasting is left entirely to the terminal emulator.
So I configured kitty.conf like this (you need to adapt this to the terminal emulator you're using):
# paste from system clipboard (and still send the key)
map ctrl+y combine : send_key ctrl+y : paste_from_clipboard
With this setup, kitty pastes the clipboard text while OpenCode still receives the key event, so image pasting continues to work. Note that I have this in my tui.jsonc:
"keybinds": {
"input_paste": "ctrl+y",
},
It might be worth updating the Copy/paste not working on Linux and/or Keybinds sections. There are quite a few copy/paste related issues in the tracker, so clarifying this could save others from having to read the code to understand what's going on. erwinzierler commented on Mar 26, 2026 Thanks for this - it helped me to get copy/paste working for text in Ghostty.
What I did:
Open (or create) ~/.config/ghostty/config
Add the line: keybind = unconsumed:ctrl+y=paste_from_clipboard
Restart Ghostty (config changes require a restart)
Make sure your tui.jsonc has "input_paste": "ctrl+y"
After this, hitting ctrl+y in OpenCode will:
Trigger Ghostty to paste your clipboard text into the terminal input
Still send the ctrl+y key event to OpenCode so image pasting keeps working
The unconsumed: prefix is the Ghostty-specific equivalent of kitty's combine chaining — worth knowing for any other keybinds you want to share between Ghostty and the app running inside it. astrolox commented on Apr 1, 2026
I dug into the code and noticed that OpenCode only handles image pasting internally. See the input_paste action. It silently ignores any pasted text.
So, perhaps someone could just update opencode to not ignore the pasted text? and that would solve all the issues? Reacted by Pedro de Carvalho TangerineNightmare commented on Apr 11, 2026 I found this issue after hitting the same wall.. I cannot cut and paste from OpenCode like every other Linux/Unix cli software under the sun. Why is this broken? please fix. What's more when I select the text it says "copied to clipboard"... but apparently some special OpenCode clipboard that normal Linux tools arent allowed to access. Reacted by Eric Johnson and Rei astrolox commented on Apr 11, 2026
apparently some special OpenCode clipboard
You can paste from this clipboard using Ctrl+V on your keyboard (but you can not paste from it by using the mouse). removed bugSomething isn't working opentuiThis relates to changes in v1.0, now that opencode uses opentui on May 3, 2026github-actions commented on Jul 3, 2026 To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one. kylebakerio commented on Aug 21, 2026 this really is infuriating and maddening for a linux user. it's enough to consider looking for another project. absolutely love this project otherwise and use it daily, but it feels bizarrely anti-linux to block middle click pasting and highlight-second-clipboard-copy.
#32370 <-- luckily this looks likely to be merged?
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|