pro.webssh.net icon indicating copy to clipboard operation
pro.webssh.net copied to clipboard

X11 Forwarding to copy output to clipboard

Open mbierman opened this issue 3 years ago • 1 comments

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

mbierman avatar Aug 19 '22 20:08 mbierman

Thank you @mbierman 🙏

isontheline avatar Aug 19 '22 20:08 isontheline

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 :

Image

isontheline avatar Nov 15 '22 21:11 isontheline

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

isontheline avatar Nov 19 '22 22:11 isontheline

I've also added documentation about this feature here : https://webssh.net/documentation/help/howtos/copying-text-to-clipboard-from-terminal/

isontheline avatar Nov 20 '22 21:11 isontheline