clipboard-apis icon indicating copy to clipboard operation
clipboard-apis copied to clipboard

No provision made for multiple clipboards, e.g. on Linux

Open keysmashes opened this issue 1 year ago • 0 comments

Linux machines frequently have multiple clipboards ("selections"). For example, using X11, in addition to the "clipboard" selection that ctrl-C and ctrl-V operate on, there is a "primary" selection which is populated with the last text to be selected, and is pasted from with middle-click. (There is also a "secondary" selection, which is at this point mostly obsolete.) Depending on the compositor, I believe the primary selection is also supported on Wayland.

The Clipboard API doesn't make any provision for the existence of these multiple clipboards. This is unfortunate: they're still widely used! For example, middle-clicking the New Tab button in Firefox and Chrome on Linux will open a new tab using the contents of the primary selection (searching it or navigating to it).

A concrete example of a place this causes issues: the Tree Style Tab extension for Firefox can't properly emulate this browser behaviour, because it can't access the primary selection when opening new tabs. See https://github.com/piroor/treestyletab/issues/3489#issuecomment-2057176634.

Is there any interest in resolving this problem in the standard? It seems like https://github.com/w3c/clipboard-apis/issues/81 covers the same problem, but was closed with no explanation four years ago.

keysmashes avatar Apr 29 '24 20:04 keysmashes