[PR #10332] feat(opencode): add linux clipboard toast warnings #13408

Open
opened 2026-02-16 18:18:16 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10332

State: open
Merged: No


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

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10332 **State:** open **Merged:** No --- ### 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
yindo added the pull-request label 2026-02-16 18:18:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13408