Skip to content

Remote Copy via OSC52

Christian Zangl edited this page Jul 6, 2022 · 4 revisions

NOTE: you only need this if you run tmux and extrakto on a server to which you connect via ssh. DO NOT USE if you run tmux and extrakto locally.

When you run a tmux session via ssh, you can copy from the remote system to your local machine via the OSC 52 escape sequence/protocol.

tmux 3.2 and later

Set in tmux.conf:

# allow OSC52 to set the clipboard
set -g set-clipboard on
set -g @extrakto_clip_tool_run "tmux_osc52"

tmux < 3.2

Create a shell script osc52 (and chmod +x) somewhere in your PATH:

#!/bin/bash
printf "\033]52;c;$(base64 | tr -d '\r\n')\a"

You can test if it works with echo hello | osc52 when in a ssh session - the text should appear on your local clipboard.

Use it in extrakto with (tmux.conf):

# allow OSC52 to set the clipboard
set -g set-clipboard on

set -g @extrakto_clip_tool_run "fg"
set -g @extrakto_clip_tool "osc52"
Clone this wiki locally