[PR #18949] Add support for OSC 52 clipboard copy in conhost #31660

Open
opened 2026-01-31 09:48:41 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/18949

State: closed
Merged: Yes


Summary of the Pull Request

This adds support for copying to the clipboard in conhost using the OSC
52 escape sequence, extending the original implementation which was for
Windows Terminal only.

References and Relevant Issues

The Windows Terminal implementation was added in PR #5823.

Detailed Description of the Pull Request / Additional comments

Because the clipboard can't be accessed from a background thread, this
works by saving the content in a global variable, and then posting a
custom message to the main GUI thread, which takes care of the actual
copy operation.

Validation Steps Performed

I've manually confirmed that tmux copy mode is now able to copy to the
system clipboard.

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/18949 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This adds support for copying to the clipboard in conhost using the OSC 52 escape sequence, extending the original implementation which was for Windows Terminal only. ## References and Relevant Issues The Windows Terminal implementation was added in PR #5823. ## Detailed Description of the Pull Request / Additional comments Because the clipboard can't be accessed from a background thread, this works by saving the content in a global variable, and then posting a custom message to the main GUI thread, which takes care of the actual copy operation. ## Validation Steps Performed I've manually confirmed that tmux copy mode is now able to copy to the system clipboard. ## PR Checklist - [x] Closes #18943
claunia added the pull-request label 2026-01-31 09:48:41 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31660