From man tmux:
set-clipboard [on | external | off]
Attempt to set the terminal clipboard content using the xterm(1)
escape sequence, if there is an Ms entry in the terminfo(5)
description (see the TERMINFO EXTENSIONS section).
If set to on, tmux will both accept the escape sequence to create
a buffer and attempt to set the terminal clipboard. If set to
external, tmux will attempt to set the terminal clipboard but
ignore attempts by applications to set tmux buffers. If off,
tmux will neither accept the clipboard escape sequence nor
attempt to set the clipboard.
Note that this feature needs to be enabled in xterm(1) by setting
the resource:
disallowedWindowOps: 20,21,SetXprop
Or changing this property from the xterm(1) interactive menu when
required.
This is how I understand the documentation; when Tmux receives a sequence encoded using the Ms capability of the outer terminal:
if
set-clipboardis set toon, the sequence is used to set the terminal clipboard and a Tmux bufferif
set-clipboardis set tooff, the sequence is neither used to set the terminal clipboard nor a Tmux bufferif
set-clipboardis set toexternal, the sequence is used to set the terminal clipboard but not a Tmux buffer
I'm using XTerm (patch 322), with $TERM set to xterm-256color, and here is its terminfo description as reported by $ infocmp -1x xterm-256color. In particular, its Ms capability is set like this:
Ms=\E]52;%p1%s;%p2%s\007
I only have these 3 lines inside ~/.Xresources:
XTerm*termName: xterm-256color
XTerm*disallowedWindowOps: 20,21,SetXprop
XTerm*selectToClipboard: true
I start Tmux with no config:
$ tmux -Lx -f/dev/null
I set set-clipboard to on:
$ tmux set -s set-clipboard on
I send an OSC 52 sequence to Tmux via printf containing the text test on:
$ printf '\e]52;c;%s\007' $(printf 'test on' | base64)
The result is that Tmux created an internal buffer, and sent the OSC 52 sequence to XTerm which populated its clipboard with test on:
$ tmux lsb
buffer0: 7 bytes: "test on"
$ xsel -b
test on
Now I reset set-clipboard to off:
$ tmux set -s set-clipboard off
I send an OSC 52 sequence to Tmux via printf containing the text test off:
$ printf '\e]52;c;%s\007' $(printf 'test off' | base64)
This time, Tmux did not create a new internal buffer, and did not send the OSC 52 sequence to XTerm:
$ xsel -b
test on
$ tmux lsb
buffer0: 7 bytes: "test on"
Otherwise one of the output of these 2 shell commands would include test off.
Finally, I reset set-clipboard to external:
$ tmux set -s set-clipboard external
I send an OSC 52 sequence to Tmux via printf containing the text test external:
$ printf '\e]52;c;%s\007' $(printf 'test external' | base64)
Tmux did not create a new internal buffer, and did not send the OSC 52 sequence to XTerm:
$ xsel -b
test on
$ tmux lsb
buffer0: 7 bytes: "test on"
Otherwise one of the output of these 2 shell commands would include test external.
I understand the results when I set set-clipboard to on and to off, but I don't understand the result when I set it to external. Based on this sentence of the Tmux man page:
If set to external, tmux will attempt to set the terminal clipboard but ignore attempts by applications to set tmux buffers.
I would have expected Tmux to send the OSC 52 sequence to XTerm, without creating an internal buffer. In practice, it does not create an internal buffer (expected), but does not send the OSC 52 sequence to XTerm either (unexpected).
I must have misunderstood this sentence. Which experiment could I perform to observe a difference between the values external and off?