Remote Tmux to Local Sway Clipboard Guide
This guide describes how to automatically sync the tmux copy buffer from a remote session (stx) over SSH through a local master tmux session (mtx) into your local Sway desktop clipboard (wl-copy) using Kitty.
How It Works
Text copied in the remote tmux session is encoded as an OSC 52 escape sequence. The sequence passes through SSH and the local tmux session directly to Kitty, which writes it to Wayland's clipboard (wl-copy).
[ Remote Tmux (stx) ] ──OSC 52──► [ SSH ] ──OSC 52──► [ Local Tmux (mtx) ] ──OSC 52──► [ Kitty ] ──► [ wl-copy ]
1. Tmux Configuration (Local mtx & Remote stx)
Add these options to ~/.tmux.conf on both your local desktop and remote server:
# Enable OSC 52 clipboard integration
set -s set-clipboard on
# Allow escape sequences (OSC 52) to pass through tmux
set -g allow-passthrough on
# Configure clipboard features for xterm/kitty terminals
set -as terminal-features ',xterm*:clipboard'
set -as terminal-overrides ',xterm*:Ms=\E]52;c;%p2%s\007'
2. Local Kitty Configuration
In ~/.config/kitty/kitty.conf on your local desktop:
clipboard_control write-clipboard write-primary read-clipboard read-primary
Ensure wl-clipboard is installed on your local desktop:
sudo pacman -S wl-clipboard
3. Usage
tmux source-file ~/.tmux.conf
Copy text inside remote tmux (via copy mode or mouse selection).
The copied text is now in your local desktop clipboard (wl-paste or Ctrl+V).