Copy to clipboard support
WebSSH1 supports2 OSC52 terminal escape sequence that allows copying text to the clipboard from within the terminal. It is supported by many other3 terminal emulators, including xterm, gnome-terminal, and iTerm2.
How to copy output to the clipboard?
It's simple as :
cat filename.txt | wshcopy
echo "WebSSH is awesome!" | wshcopy
wshcopy will handle the output and send it to WebSSH by using "invisible" terminal chars.
Daemon hides under terminal
As the terminal can do "untrusted" things, WebSSH will ask you (by default) if you approve or deny the clipboard access.
You can change this behavior inside WebSSH settings (iOS : within system settings > WebSSH > SSH / macOS : within the app settings > SSH) : "Clipboard Access Strategy"
How to install wshcopy
pip3 install webssh-sh
How to use with tmux >= 3.3
set -g allow-passthrough onTHEN
echo "WebSSH is awesome!" | wshcopy -t tmux
set -g set-clipboard onTHEN
echo "WebSSH is awesome!" | wshcopy -t default
I would like to improve wshcopy
Repository is here : webssh-sh
Documentation about OSC52 Terminal Escape Sequence
OSC 52 Sequence
The sequence consists of the following:
OSC 52 ; Pc ; Pd BEL
- Pc is the clipboard choice:
|Choice||Description||Supported by WebSSH|
- Pd is the data to copy to the clipboard. This string should be encoded in base64 RFC-4648.
- If Pd is "?", the terminal replies to the host with the current contents of the clipboard.
- If Pd is neither a base64 string nor "?", the terminal clears the clipboard.