Skip to content

Consider using the device attributes report to detect OSC 52 support #4532

@j4james

Description

@j4james

Issue description

As far as I understand it, tmux will automatically make use of the OSC 52 clipboard functionality on terminals that have the Ms capability. But that's not particularly reliable, because many terminals will set their TERM to some xterm variant without necessarily matching all of xterm's features. And those that do support OSC 52 are not guaranteed to have the functionality enabled anyway.

So instead I want to you to consider using the primary device attributes report, and looking for the feature number 52 in the list of supported extensions. This is a recent extension that a number of terminals have agreed to support, and indicates that the terminal is capable of copying to the clipboard with OSC 52 using a Pc value of c or an empty Pc value.

I'm not suggesting you make this change immediately, because I don't think any terminals have actually shipped with this extension in their DA report yet, but I just wanted to raise the issue now to see if you would be interested in making use of the functionality once it is actually available.

I should also be clear that this extension only indicates support for writing to the clipboard. It does not guarantee that you'll be able to read from the clipboard with an OSC 52 query.

Required information

I don't think any of this is relevant, because this suggestion is applicable to multiple platforms and terminals, but fwiw...

  • tmux version (tmux -V): next-3.6
  • Platform (uname -sp): Linux x86 64
  • $TERM inside tmux: tmux-256color
  • $TERM outside of tmux: xterm-256color

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions