From aed42472ac58121d50e16951ba255585b15e95d4 Mon Sep 17 00:00:00 2001 From: Armand Lynch Date: Sun, 22 Mar 2026 11:24:04 -0400 Subject: [PATCH] fix(tui): update clipboard and paste handling for opentui 0.1.88 --- .../src/cli/cmd/tui/util/clipboard.ts | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/util/clipboard.ts b/packages/opencode/src/cli/cmd/tui/util/clipboard.ts index 7af1710668..4668f168ca 100644 --- a/packages/opencode/src/cli/cmd/tui/util/clipboard.ts +++ b/packages/opencode/src/cli/cmd/tui/util/clipboard.ts @@ -1,4 +1,3 @@ -import { $ } from "bun" import { platform, release } from "os" import clipboardy from "clipboardy" import { lazy } from "../../../../util/lazy.js" @@ -103,20 +102,18 @@ export namespace Clipboard { } export async function readPrimary(): Promise { - const os = platform() - if (os === "linux") { - if (process.env["WAYLAND_DISPLAY"] && Bun.which("wl-paste")) { - const text = await $`wl-paste --primary --no-newline`.nothrow().text() - if (text) return text - } - if (Bun.which("xclip")) { - const text = await $`xclip -selection primary -o`.nothrow().text() - if (text) return text - } - if (Bun.which("xsel")) { - const text = await $`xsel --primary --output`.nothrow().text() - if (text) return text - } + if (platform() !== "linux") return + if (process.env["WAYLAND_DISPLAY"] && which("wl-paste")) { + const result = await Process.text(["wl-paste", "--primary", "--no-newline"], { nothrow: true }) + if (result.text) return result.text + } + if (which("xclip")) { + const result = await Process.text(["xclip", "-selection", "primary", "-o"], { nothrow: true }) + if (result.text) return result.text + } + if (which("xsel")) { + const result = await Process.text(["xsel", "--primary", "--output"], { nothrow: true }) + if (result.text) return result.text } }