X11 Forwarding to copy output to clipboard
Feature description
I often use pbcopy on the mac to grab command output to the clipboard.
This can be used with webssh too via: xclip -sel clip. For example:
cat filename | xclip -sel clip
but currently this error is given:
Error: Can't open display: (null)
This explanation (with 56 votes) seems to address it, but I am not sure how to put this into effect with Web SSH?
This will require webssh to support X11 Forwarding which would allow copying output of a command to the clipboard!
Screenshots / Draws
Thank you @mbierman 🙏
For @isontheline :
- https://github.com/xtermjs/xterm.js/issues/3260
- https://golangexample.com/copy-text-to-the-system-clipboard-from-anywhere-using-the-ansi-osc52-sequence/
- https://github.com/ojroques/vim-oscyank/blob/main/README.md
- https://chromium.googlesource.com/apps/libapps/+/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/doc/ControlSequences.md#osc
iTerm2 is asking to allow access to clipboard :

Hello @mbierman 👋
As I can't implement X11 Forwarding inside WebSSH - yet - I have implemented OSC 52 Terminal Sequence (https://chromium.googlesource.com/apps/libapps/+/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/doc/ControlSequences.md#osc)
In order to copy some data to your macOS / iOS clipboard from the terminal you will need to use this for example :
echo "WebSSH is awesome!" | wshcopy
cat filename | wshcopy
wshcopy command can be installed on your servers using : pip3 install webssh-sh
Hope this will stick to your need
I've also added documentation about this feature here : https://webssh.net/documentation/help/howtos/copying-text-to-clipboard-from-terminal/