Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Support for setting clipboard #561

Closed
Consolatis opened this issue Sep 24, 2022 · 6 comments
Closed

[Feature request] Support for setting clipboard #561

Consolatis opened this issue Sep 24, 2022 · 6 comments

Comments

@Consolatis
Copy link

Terminfo seems to provide Ms for this case so it can be feature detected and used pretty easy:

test -n "$(tput Ms)" && tput Ms c "$(printf "%s" "enjoy your new clipboard content" | base64 --wrap=0)"
Consolatis added a commit to Consolatis/tcell that referenced this issue Sep 26, 2022
Consolatis added a commit to Consolatis/tcell that referenced this issue Sep 26, 2022
Consolatis added a commit to Consolatis/tcell that referenced this issue Sep 26, 2022
@gdamore
Copy link
Owner

gdamore commented Oct 14, 2022

Interesting. How would you expect an application to meaningfully use this? It's something new to me.

@gdamore
Copy link
Owner

gdamore commented Oct 14, 2022

Another reference: microsoft/terminal#2946

@Consolatis
Copy link
Author

Consolatis commented Oct 14, 2022

Interesting. How would you expect an application to meaningfully use this?

Well, just setting the clipboard to something (if the terminal emulator in use supports it).
An example would be to copy something from an editor or some messages from an IRC client.

delthas pushed a commit to delthas/tcell that referenced this issue Jul 5, 2023
@bjorndm
Copy link
Contributor

bjorndm commented Aug 15, 2023

@Consolatis A Go clipboard library like https://github.com/golang-design/clipboard should be better than tcell as a solution for this problem.

@bjorndm
Copy link
Contributor

bjorndm commented Aug 15, 2023

Of course it depends on which clipboard you want to access, if it is a ssh application, then with a clipboard library like I potsed you cna only get the local clipboard (of where the application is running), which may be the wrong clipboard...

@Consolatis
Copy link
Author

Consolatis commented Aug 29, 2023

@bjorndm The variant proposed here and in #562 is much better (for terminal applications) than any random external clipboard library as it just tells the terminal emulator in use to set the clipboard content. It is then the job of the terminal emulator to actually do that. This works across ssh and on any OS which has a terminal emulator that supports the Ms capability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants