Skip to content

feat(osc52): support tmux clipboard writes via OSC 52#21

Merged
amirlehmam merged 1 commit into
amirlehmam:masterfrom
schroldgames:feat/osc52-clipboard
Jun 3, 2026
Merged

feat(osc52): support tmux clipboard writes via OSC 52#21
amirlehmam merged 1 commit into
amirlehmam:masterfrom
schroldgames:feat/osc52-clipboard

Conversation

@schroldgames

Copy link
Copy Markdown
Contributor

Summary

  • Registers an OSC 52 handler in xterm.js so tmux copy-mode writes reach the Windows system clipboard
  • Routes through Electron's clipboard module via IPC rather than navigator.clipboard, which requires a user-gesture context that PTY data callbacks don't have
  • Adds clipboard:write-text IPC channel in main process and exposes it via preload

How it works

When tmux has set-clipboard on (provided by tmux-sensible by default), it emits \x1b]52;c;<base64>\x07 to the outer terminal after each copy. wmux now handles that sequence and writes the decoded text to the Windows clipboard.

Testing

  1. Open a tmux session in a wmux terminal pane
  2. Click and drag to select text — it should appear in the Windows clipboard
  3. In a plain (non-tmux) pane: printf '\033]52;c;dGVzdA==\007' should write test to clipboard

No tmux config changes are required — tmux-sensible already enables the necessary settings.

🤖 Generated with Claude Code

Registers an OSC 52 handler in xterm.js so tmux copy-mode (with
set-clipboard on + terminal-features clipboard) can write to the Windows
system clipboard. Routes through Electron's clipboard module via IPC
rather than navigator.clipboard, which requires a user-gesture context
that PTY data callbacks don't have.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@amirlehmam amirlehmam merged commit 00e3b2d into amirlehmam:master Jun 3, 2026
@schroldgames schroldgames deleted the feat/osc52-clipboard branch June 5, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants