Skip to content

Conversation

@mitsadx
Copy link

@mitsadx mitsadx commented Jan 24, 2026

What does this PR do?

  • Adds Linux clipboard feedback in the TUI: when native clipboard tools are missing, every copy action shows a warning; when a tool exists (wl-copy/xclip/xsel), the first copy shows a single “using tool” notice.
    Why
    On Linux, copying can silently fail if clipboard utilities aren’t installed. This change makes the requirement explicit and reduces confusion.
    Technical change path
    Core clipboard logic updated in packages/opencode/src/cli/cmd/tui/util/clipboard.ts:
    • Clipboard.copy now returns a CopyResult with optional notice/warning.
    • For Linux:
      • If wl-copy/xclip/xsel is found, returns a one‑time notice (Clipboard: using ...).
      • If none are found, returns a warning every time (install wl-clipboard, xclip, or xsel).
  • TUI copy call sites now consume CopyResult and show toasts:
    • packages/opencode/src/cli/cmd/tui/app.tsx (selection copy)
    • packages/opencode/src/cli/cmd/tui/ui/dialog.tsx (dialog selection copy)
    • packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx (provider auth code copy)
    • packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx (message copy)
    • packages/opencode/src/cli/cmd/tui/routes/session/index.tsx (share link, copy last assistant, copy transcript)
      Effect
  • Linux users get immediate, visible guidance when clipboard tools are missing.
  • With xclip/wl-copy/xsel installed, the tool choice is confirmed once and then stays quiet.

How did you verify your code works?

I didn’t run automated tests. Verification so far is manual: start bun dev, trigger copy actions, and confirm the toast behavior (one‑time notice when a tool exists, warning every time when tools are missing). If you want, I can run it and report back.
Fixes #10333

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found several related PRs that address clipboard functionality on Linux:

Potentially Related PRs:

  1. PR fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste #6370 - "fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste"

    • Related to Linux clipboard support and cross-platform clipboard handling
  2. PR feat: add native X11 clipboard support for Linux #5908 - "feat: add native X11 clipboard support for Linux"

    • Directly addresses Linux clipboard support, likely related to the foundation of this work
  3. PR fix(clipboard): add OSC 52 fallback for SSH/tmux environments #7028 - "fix(clipboard): add OSC 52 fallback for SSH/tmux environments"

  4. PR fix(tui): fix Ctrl+V paste on Windows/WSL2 (#6560 and #8209) #8626 - "fix(tui): fix Ctrl+V paste on Windows/WSL2"

    • While focused on paste rather than copy, it's part of the broader clipboard handling improvements

Assessment: These PRs are all related to clipboard functionality but address different scenarios (X11/Wayland support, fallback strategies, paste operations). PR #10332 appears to be the first to specifically add toast warnings and user feedback for missing clipboard tools. None appear to be direct duplicates, but they're all part of clipboard robustness work.

@mitsadx mitsadx changed the title feat(opencode): add linux clipboard toast warnings feat(opencode): add linux clipboard toast warnings Fixes #<10333> Jan 24, 2026
@mitsadx mitsadx changed the title feat(opencode): add linux clipboard toast warnings Fixes #<10333> feat(opencode): add linux clipboard toast warnings Jan 24, 2026
@mitsadx
Copy link
Author

mitsadx commented Jan 24, 2026

Hi maintainers, thanks for the review! There are 2 workflows awaiting approval on this PR. Could you please approve them so the checks can run? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]:Linux TUI: show clipboard tool notice/warning on copy

1 participant