Skip to content

Detect support for OSC 52 using the device attributes report#4539

Closed
j4james wants to merge 1 commit intotmux:masterfrom
j4james:osc52-detection
Closed

Detect support for OSC 52 using the device attributes report#4539
j4james wants to merge 1 commit intotmux:masterfrom
j4james:osc52-detection

Conversation

@j4james
Copy link

@j4james j4james commented Jun 22, 2025

Detect support for OSC 52 using the device attributes report

This is an extension agreed upon by modern terminals to indicate that
they support copying to the clipboard with XTerm's OSC 52 sequence.
On terminals that can disable clipboard access, this extension is only
reported when writing to the clipboard is actually allowed, so this is
a more reliable indicator than the Ms terminfo capability.

Fixes #4532

This is an extension agreed upon by modern terminals to indicate that
they support copying to the clipboard with XTerm's OSC 52 sequence.
On terminals that can disable clipboard access, this extension is only
reported when writing to the clipboard is actually allowed, so this is
a more reliable indicator than the Ms terminfo capability.
@j4james
Copy link
Author

j4james commented Jun 22, 2025

@nicm I'm not sure if this is what you had in mind, but I've tested on Windows Terminal by setting my TERM to vt525, and then checking whether I could copy to the clipboard from the tmux buffer with Ctrl+W. On the release build of Windows Terminal it doesn't work (because the Ms cap isn't in the vt525 terminfo), but on the canary build it does (because that now includes the 52 extension parameter in its device attributes report).

craigbarnes added a commit to craigbarnes/dte that referenced this pull request Jun 23, 2025
@nicm
Copy link
Member

nicm commented Jun 24, 2025

Applied to OpenBSD now, will be in GitHub later. Thanks!

@nicm nicm closed this Jun 24, 2025
@j4james j4james deleted the osc52-detection branch July 1, 2025 08:00
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Consider using the device attributes report to detect OSC 52 support

2 participants