Copy through the clipboard tool when OSC 52 is refused
OpenTUI 0.8 throws when asked for OSC 52 while it isn't drawing.
This commit is contained in:
1 parent
60e2357dab
commit
ba157ccab7
1 file changed
+5
-1
@@ -31,7 +31,11 @@ export function desktopNotify(title: string, body: string): void {
|
|||||||
* desktop through its clipboard tool too, for terminals that ignore OSC 52.
|
* desktop through its clipboard tool too, for terminals that ignore OSC 52.
|
||||||
*/
|
*/
|
||||||
export function copyText(renderer: CliRenderer, text: string): void {
|
export function copyText(renderer: CliRenderer, text: string): void {
|
||||||
renderer.copyToClipboardOSC52(text);
|
try {
|
||||||
|
renderer.copyToClipboardOSC52(text);
|
||||||
|
} catch {
|
||||||
|
// OpenTUI refuses when it isn't drawing (suspended, or a test renderer); the tool may still copy.
|
||||||
|
}
|
||||||
if (process.env.SSH_CONNECTION) return;
|
if (process.env.SSH_CONNECTION) return;
|
||||||
const tool =
|
const tool =
|
||||||
process.platform === "darwin" ? ["pbcopy"] : process.env.WAYLAND_DISPLAY ? ["wl-copy"] : process.env.DISPLAY ? ["xclip", "-selection", "clipboard"] : null;
|
process.platform === "darwin" ? ["pbcopy"] : process.env.WAYLAND_DISPLAY ? ["wl-copy"] : process.env.DISPLAY ? ["xclip", "-selection", "clipboard"] : null;
|
||||||
|
|||||||
Reference in new issue
Block a user