1

I use xterm that comes with XQuartz on my macbook. However OSC 52 control sequence doesn't seem to work. Here's how to repro:

  1. open xterm
  2. in the shell, issue printf '\e]52;c;%s\007' $(printf 'test off' | base64)
  3. try to "paste" in somewhere else, e.g., TextEdit

I don't see the text "test off" being copied in TextEdit. So seems my xterm's OSC 52 support is broken.

How can I fix it or further root cause it?


from these sources, it looks like xterm does support OSC 52:

1
  • 2
    ctlseqs.html tells you why. You'd need to enable it which would be an unwise thing to do as that would introduce security vulnerabilities. Commented Aug 16, 2021 at 9:32

1 Answer 1

4

As commented by Stéphane, xterm does support this feature. You can enable it from the Font Menu -> allow window ops, or by xresource string:

allowWindowOps: true 

This is documented in xterm's man page.

One can selective disallow a subset of window ops as @cyqsimon mentioned: with disallowedWindowOps (see man xterm). However I have not had time to figure out the proper ops to disallow to only allow-list copy/paste ops.

3
  • 1
    Those WindowOps are disabled for good reason though, some even worse from a security standpoint than OSC 52 (which allows applications to produce output that will set selections, or dump them as if input on the keyboard). You may want to restrict which window op you want allowed with disallowedWindowOps instead. Only removing SetSelection from the default set for instance. Commented Aug 17, 2021 at 8:42
  • To set the X selections from within scripts, you may want to have a look at commands such as xclip or xsel instead. See also pbcopy/pbpaste on macos to manipulate the macos clipboard. See Copy the contents of a file into the clipboard without displaying its contents Commented Aug 17, 2021 at 8:52
  • 1
    Seems like WindowOps can be partially enabled. See here. If this works then it's probably best practice. Commented Aug 4, 2022 at 13:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.