helix
helix copied to clipboard
Enable OSC52 automatically if connected via SSH
When connecting via ssh to a macOS host, helix still uses pbcopy+pbpaste as a clipboard provider instead of OSC52.
I think this is not a problem when the remote is a Linux host, as helix checks for WAYLAND_DISPLAY/DISPLAY environment variables, which are normally not set in an SSH session. (at least I never had problems with Linux remotes)
My enhancement would be to check for the $SSH_CONNECTION environment variable, and if this is set, it would use the FallbackProvider instead of pbcopy+pbpaste.
As I mentioned before, this seems to be only a problem if the remote is macOS, so it would probably be suffice to add this check to the macOS target of the get_clipboard_provider method.
I'd also be willing to open a PR for this.
I'd be willing to test and confirm said PR.
Yes this seems to work just fine in Linux. No Wayland specific environment variables are passed via SSH and "+y will copy text to the system clipboard.
I spent couple of hours trying to get OSC52 working from Ubuntu over SSH from my mac iterm2. It works fine in terminal using:
printf '\e]52;c;dGVzdA==\a'
This is just a wrap of Base64 string, using OSC 52 escape sequence: \e]52;c;BASE64_TEXT\a. \e] : Starts an OSC sequence. 52 : Identifies it as the clipboard command. ;c; : Specifies the "clipboard" selection (other selections exist but 'c' is standard clipboard). BASE64_TEXT : The Base64 encoded version of the text you want to copy. \a : The "Bell" character, used to terminate the sequence.
So it workes from the server to my client, but I cant get hx to output this when i yank to system clipboard.