2024-10-02 Copy from ssh session
I wrote myself the following `fish` function that uses OSC 52 as explained by jdhao in order to copy text from within a `ssh` session into the local (client-side) clipboard. OSC stands for Operating System Command.
function ssh-copy --description 'Copy text to the local clipboard'
read -z -l input
printf "\033]52;c;"
printf "%s" $input | base64
printf "\a"
end
I need to install this for every remote account, of course, because it has to exist on the remote end. Use `funced --save ssh-copy` to do it.
Here's an example of how to use it:
alex@melanobombus ~> ssh sibirocobombus This is the server. You have new mail. alex@sibirocobombus ~> echo hello | ssh-copy alex@sibirocobombus ~> exit Connection to alexschroeder.ch closed. alex@melanobombus ~> wl-paste hello
`wl-paste` and `wl-copy` are from the `wl-clipboard` package for Wayland.