|
|
Subscribe / Log in / New account

Emacs 29.1 released

Emacs 29.1 released

Posted Aug 1, 2023 8:44 UTC (Tue) by Sesse (subscriber, #53779)
In reply to: Emacs 29.1 released by NYKevin
Parent article: Emacs 29.1 released

OK, so the point is that terminals support this when running under X11, but not the equivalent protocol under Wayland? Or that there exists a semi-reasonable workaround (xclip with X forwarding) for X11 that does not exist in Wayland?

(FWIW, I use vim as my only editor, but I never use "+ or "*. Obviously your workflow is different.)


to post comments

Emacs 29.1 released

Posted Aug 1, 2023 15:22 UTC (Tue) by NYKevin (subscriber, #129325) [Link] (5 responses)

I don't know that Wayland *has* an equivalent protocol (to X11 forwarding). If it does, I've never seen any SSH flags etc. for it.

OSC-52 is a generic terminal/serial protocol that can be implemented by anybody on any kind of windowing system, but it just handles clipboard access (whereas X11 forwarding is a far more complex beast that lets you run a whole X client over SSH). The extremely simple version is, the program outputs some control characters, which describe either a copy or a paste, and the terminal emulator is responsible for doing the copy/paste operation as requested, so the program doesn't need to know anything about $DISPLAY etc. in order to access the system clipboard.

Most of the gnome-terminal bikeshedding is of the "but what if somebody has something sensitive in their clipboard?" variety. The standard solution to this problem appears to be write-only access, i.e. you implement copy but not paste (or have paste just output an empty string), so that at worst a remote host can clobber your clipboard, but it can't read secrets from your clipboard.

Emacs 29.1 released

Posted Aug 1, 2023 15:56 UTC (Tue) by Sesse (subscriber, #53779) [Link] (4 responses)

I wasn't asking about a gnome-terminal rant, I was trying to figure out whether my understanding of your use case was correct. :-) Because if the point really only is to have a workaround for copying clipboard contents from terminal applications over SSH, that would seem rather marginal for a windowing system's functions.

Now, it sure would be nice to have some sort of network transparency for graphics even as we phase out X11. But that feels like a different issue to me.

Emacs 29.1 released

Posted Aug 1, 2023 18:35 UTC (Tue) by NYKevin (subscriber, #129325) [Link] (2 responses)

> Because if the point really only is to have a workaround for copying clipboard contents from terminal applications over SSH, that would seem rather marginal for a windowing system's functions.

I agree. That's why I wrote a "rant" about gnome-terminal: This should be the terminal emulator's problem, not the windowing system's problem.

Emacs 29.1 released

Posted Aug 2, 2023 16:44 UTC (Wed) by Per_Bothner (subscriber, #7375) [Link] (1 responses)

"This should be the terminal emulator's problem, not the windowing system's problem."

Right - but unfortunately there is no simple portable API for accessioning the clipboard. Even for JavaScript-based terminal emulators (such as DomTerm and xterm.js) there are security policies that limit access. The simplest is to invoke a helper application - but these aren't portable either. If curious you can look at the code for get_clipboard_command in lws-term/utils.cc in the DomTerm sources.

Emacs 29.1 released

Posted Aug 3, 2023 17:27 UTC (Thu) by farnz (subscriber, #17727) [Link]

In this context, OSC 52 is that API - it's an API between an application and the terminal emulator, allowing the application running in the terminal to ask the terminal emulator to perform clipboard accesses for it.

The problem is that VTE, one of the common implementations of a terminal emulator (used by GNOME Terminal, among others), deliberately doesn't support this API. As a result, instead of terminal applications like vim using OSC 52, they use a remote X11 connection to access the clipboard using X11 APIs, while rendering using terminal APIs like OSC. This is a hack around the lack of OSC 52 support in common terminal emulators.

Emacs 29.1 released

Posted Sep 18, 2023 6:55 UTC (Mon) by daenzer (subscriber, #7050) [Link]

> Now, it sure would be nice to have some sort of network transparency for graphics even as we phase out X11.

FWIW, there's Waypipe, which works more or less like X11 over SSH from a user PoV: https://gitlab.freedesktop.org/mstoeckl/waypipe

> But that feels like a different issue to me.

Yeah, since this discussion is about a feature of the terminal emulator, which should normally run locally in the user session, I'm not sure how SSH tunnelling of the display protocol is relevant.

Emacs 29.1 released

Posted Aug 1, 2023 16:01 UTC (Tue) by intelfx (subscriber, #130118) [Link]

> Or that there exists a semi-reasonable workaround (xclip with X forwarding) for X11 that does not exist in Wayland?

This, yes.

The problem: users want terminal applications to interact with the system clipboard. By extension, users also want _remote_ terminal applications to interact with the _local_ system clipboard (think Vim over SSH).

The solution: an escape sequence protocol (OSC-52) was invented to do exactly that, and it trivially works over any nested configuration of remote shells (application emits an escape sequence -> remote shells relay that sequence -> user's terminal emulator parses the escape sequence and acts on it).

HOWEVER, VTE developers think that OSC 52 is a security threat and refuse to implement it. The closest possible workaround is for the terminal applications to "piggyback" on the X11 clipboard directly, because everyone who cares about this feature is ultimately sitting in an X11 environment. This workaround is "local" in nature, but it can be extended to remote sessions by way of SSH X11 forwarding.

The problem #2 is that Wayland has no equivalent of X11 forwarding.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds