Skip to content

fix(clipboard): warn on missing clipboard tools instead of silent failure#897

Open
hiwujie wants to merge 1 commit into
XiaomiMiMo:mainfrom
hiwujie:fix/clipboard-warn-missing-tools
Open

fix(clipboard): warn on missing clipboard tools instead of silent failure#897
hiwujie wants to merge 1 commit into
XiaomiMiMo:mainfrom
hiwujie:fix/clipboard-warn-missing-tools

Conversation

@hiwujie

@hiwujie hiwujie commented Jun 17, 2026

Copy link
Copy Markdown

Problem

On Ubuntu and other Linux distros (including UOS), copy silently fails -- the UI shows "copied to clipboard" but nothing is actually copied.

The clipboard fallback chain:

  1. OSC 52 escape sequence -- disabled by default in many terminals
  2. Native tools: wl-copy / xclip / xsel -- missing on minimal installs
  3. clipboardy npm package -- depends on xclip/xsel, also fails silently

Result: .catch(() => {}) swallows all errors, user sees success toast, clipboard is empty.

Fix

Two small changes to clipboard.ts:

1. getCopyMethod -- warn when no native clipboard tool is found on Linux

After trying wl-copy, xclip, xsel and all missing, log a clear warning with install instructions.

2. writeOsc52 -- warn about tmux allow-passthrough

When running inside tmux, log a reminder that OSC 52 requires set -g allow-passthrough on.

Why this approach

  • Works for all Linux terminals, not just XTerminal (compare: PR fix(tui): avoid OSC52 success on XTerminal #192 hardcodes TERM_PROGRAM === "xterminal")
  • Users get actionable instructions instead of silent failure
  • No behavior change for systems where clipboard tools exist

Related

…lure

On Linux, when no native clipboard tool (xclip/xsel/wl-copy) is found,
log a clear warning with install instructions instead of silently failing.
Also warn about tmux allow-passthrough requirement for OSC 52.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

鼠标选中文本提示已复制,但 XTerminal 不支持 OSC 52 导致剪切板为空

1 participant