fix(tui): update clipboard and paste handling for opentui 0.1.88
parent
82d54654d5
commit
aed42472ac
|
|
@ -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<string | undefined> {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue