Wayland clipboard copy doesn't populate primary clipboard selection #3834

Open
opened 2026-02-16 17:41:37 -05:00 by yindo · 2 comments
Owner

Originally created by @mickalpine on GitHub (Dec 24, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

When using opencode in Wayland environments with wl-clipboard, copying text via highlight selection or Ctrl+Y only populates the regular clipboard but not the primary clipboard. This prevents pasting to the host OS when using VMware Workstation, which only syncs the primary clipboard between guest and host.

Additional context:

  • wl-clipboard version: 2.2.1
  • In VMware Workstation, only the primary clipboard gets synced between guest and host OS
  • The issue affects both the highlight-to-copy functionality and the Ctrl+Y explicit copy command

Proposed solution:
Add a configuration option to control clipboard behavior in Wayland environments:

{
  "clipboard": {
    "linux": {
      "enablePrimaryCopy": true
    }
  }
}

When enablePrimaryCopy is true, the Wayland copy method should execute both wl-copy and wl-copy --primary.

OpenCode version

v1.0.195

Steps to reproduce

  1. Run opencode TUI in a Wayland environment (Ubuntu 24.04)
  2. Highlight text and copy using Ctrl+Y or text selection
  3. In a terminal, check clipboard contents:
    • wl-paste (regular clipboard) - should show the copied text ✓
    • wl-paste --primary (primary clipboard) - should show the copied text ✗
  4. Try to paste using middle-click (primary clipboard) - fails
  5. Try to paste using Ctrl+V (regular clipboard) - works

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04 (Gnome Wayland)

Terminal

ghostty v1.2.3

Originally created by @mickalpine on GitHub (Dec 24, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description When using opencode in Wayland environments with wl-clipboard, copying text via highlight selection or Ctrl+Y only populates the regular clipboard but not the primary clipboard. This prevents pasting to the host OS when using VMware Workstation, which only syncs the primary clipboard between guest and host. **Additional context:** - wl-clipboard version: 2.2.1 - In VMware Workstation, only the primary clipboard gets synced between guest and host OS - The issue affects both the highlight-to-copy functionality and the Ctrl+Y explicit copy command **Proposed solution:** Add a configuration option to control clipboard behavior in Wayland environments: ```json { "clipboard": { "linux": { "enablePrimaryCopy": true } } } ``` When `enablePrimaryCopy` is `true`, the Wayland copy method should execute both `wl-copy` and `wl-copy --primary`. ### OpenCode version v1.0.195 ### Steps to reproduce 1. Run opencode TUI in a Wayland environment (Ubuntu 24.04) 2. Highlight text and copy using Ctrl+Y or text selection 3. In a terminal, check clipboard contents: - `wl-paste` (regular clipboard) - should show the copied text ✓ - `wl-paste --primary` (primary clipboard) - should show the copied text ✗ 4. Try to paste using middle-click (primary clipboard) - fails 5. Try to paste using Ctrl+V (regular clipboard) - works ### Screenshot and/or share link _No response_ ### Operating System Ubuntu 24.04 (Gnome Wayland) ### Terminal ghostty v1.2.3
yindo added the opentuibug labels 2026-02-16 17:41:37 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 24, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #6111: Copy to clipboard broken over SSH (MobaXterm & Windows Terminal) - Both relate to clipboard functionality not working properly
  • #6072: X Window (xorg) middle-click paste doesn't work - Related Linux/Wayland clipboard issue
  • #5640: copy paste api key under kubuntu - Another Wayland environment clipboard issue
  • #4754: Copy and Paste behaviour under Linux - General Linux clipboard behavior issue
  • #3684: [FEATURE]: On Linux/Wayland allow pasting with middle click - Related Wayland paste functionality

These issues all relate to clipboard and copy/paste functionality on Linux/Wayland environments. Feel free to ignore if this is addressing a specific edge case not covered by the others.

@github-actions[bot] commented on GitHub (Dec 24, 2025): This issue might be a duplicate of existing issues. Please check: - #6111: Copy to clipboard broken over SSH (MobaXterm & Windows Terminal) - Both relate to clipboard functionality not working properly - #6072: X Window (xorg) middle-click paste doesn't work - Related Linux/Wayland clipboard issue - #5640: copy paste api key under kubuntu - Another Wayland environment clipboard issue - #4754: Copy and Paste behaviour under Linux - General Linux clipboard behavior issue - #3684: [FEATURE]: On Linux/Wayland allow pasting with middle click - Related Wayland paste functionality These issues all relate to clipboard and copy/paste functionality on Linux/Wayland environments. Feel free to ignore if this is addressing a specific edge case not covered by the others.
Author
Owner

@mickalpine commented on GitHub (Jan 22, 2026):

@rekram1-node I created a PR to solve this issue #6370

To enable primary clipboard copy it would be add to opencode config (default is false):

{
  "clipboard": {
    "linux": {
      "enablePrimaryCopy": true
    }
  }
}
@mickalpine commented on GitHub (Jan 22, 2026): @rekram1-node I created a PR to solve this issue #6370 To enable primary clipboard copy it would be add to opencode config (default is false): ```json { "clipboard": { "linux": { "enablePrimaryCopy": true } } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3834