fix(coding-agent): skip X11-only native addon for /copy on Linux
The @mariozechner/clipboard native addon uses clipboard-rs, which is X11-only and does not retain selection ownership after set_text resolves. On Wayland-only compositors (Hyprland, Niri, ...) /copy reported success without populating the clipboard. Skip the native addon on Linux and let wl-copy/xclip/xsel handle text writes; they properly daemonize. closes #4177
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
- Fixed `pi -p` treating prompts that start with YAML frontmatter as extension flags instead of user messages ([#4163](https://github.com/badlogic/pi-mono/issues/4163)).
|
||||
- Fixed pending tool results not updating in the live TUI after toggling thinking block visibility while the tool is running ([#4167](https://github.com/badlogic/pi-mono/issues/4167)).
|
||||
- Fixed `/copy` reporting success on Linux without writing the clipboard on Wayland-only compositors (Hyprland, Niri, ...) by skipping the X11-only native addon on Linux and routing through `wl-copy`/`xclip`/`xsel` instead ([#4177](https://github.com/badlogic/pi-mono/issues/4177)).
|
||||
|
||||
## [0.73.0] - 2026-05-04
|
||||
|
||||
|
||||
@@ -35,11 +35,20 @@ function emitOsc52(text: string): boolean {
|
||||
export async function copyToClipboard(text: string): Promise<void> {
|
||||
let copied = false;
|
||||
|
||||
const p = platform();
|
||||
|
||||
// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals
|
||||
// write the same native clipboard concurrently with the addon, and very large
|
||||
// OSC 52 payloads can desynchronize terminal rendering.
|
||||
//
|
||||
// On Linux, skip the native addon. The underlying `clipboard-rs` crate is
|
||||
// X11-only and does not retain selection ownership after `set_text`
|
||||
// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even
|
||||
// some X11 sessions the call resolves successfully without populating the
|
||||
// clipboard. The platform tools below (wl-copy, xclip, xsel) properly
|
||||
// daemonize and keep ownership.
|
||||
try {
|
||||
if (clipboard) {
|
||||
if (clipboard && p !== "linux") {
|
||||
await clipboard.setText(text);
|
||||
copied = true;
|
||||
}
|
||||
@@ -52,7 +61,6 @@ export async function copyToClipboard(text: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
const p = platform();
|
||||
const options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: ["pipe", "ignore", "ignore"] };
|
||||
|
||||
if (!copied) {
|
||||
|
||||
Reference in New Issue
Block a user