Skip to content

Conversation

@alsharifnahas
Copy link

@alsharifnahas alsharifnahas commented Jul 26, 2025

This adds support for writing to clipboard via OSC52 only if an SSH session is active. Read support, if supported, is often blocked by terminals or prompted for security reasons. This PR only adds write support for simplicity. Read support, though more complicated, can be added in a separate PR since it requires reading the terminal for response in an asynchronous manner which can also affect TUI applications using this library.

Fixes: #73


import "os"

var isSsh = os.Getenv("SSH_TTY") != ""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditioning on SSH seems strange. I see how it narrowly focuses it on your case, but is there a better way to tell OSC-52 should be used?

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.

Improvement suggestion: add OSC52 as alternate method for copying to clipboard

2 participants