I am running Wayland on Ubuntu 18.04.
According to the Wayland FAX, one of it's advantages, compared to X11, is that
Wayland allows better isolation between processes: one window cannot access resources from, or inject keystrokes into, another window.
That same Wayland document also says that
because Emacs is not a real GTK apps, it still talks with X11 and therefore will use XWayland
where XWayland is described as:
Note that any X program will still run, as there is a XWayland server that provides backwards compatibility with X program. Those programs will not, however, benefit from the security and performance improvements Wayland provides.
There is a 2016 devlevel discussion thread which considers removing X11 dependency from Emacs - notably a condition already achieved in Win23 and NS versions of Emacs.
It's now 2019 and so my question is, as the title states:
Is there an X11-free build of Emacs that can run on Wayland (not going through XWayland)?
If the answer is no, I do have another question which is probably off topic for this list:
Why can't Wayland just intercept all X11 calls in XWayland and convert them into proper Wayland calls?
Edit Background Info: Apparently Electron (which the editor Atom uses to interface with Linux) has some X-call dependencies which require a setting DISABLE_WAYLAND=1
causing it to run via XWayland when running on Wayland. Also see Arch docs on Wayland which suggests setting GDK_BACKEND=x11
for Electron. So it's by no means an Emacs only issue.
Edit: Clarification (c.f. @phils very helpful and through provoking comments)
Wayland does intercept X11-calls, and of course Wayland-calls. However, the Wayland documention suggests only the Wayland calls enjoy the security benefits that Wayland has to offer.
As @phils and @wasamasa point out, emacs-nox
makes no X-calls, so it should theoretically be able to run on a terminal-emulator (e.g. terminology, termite) which itself is using only Wayland protocol, and not X-protocol.
Testing that on Ubuntu has turned out not to simple, as even with a Wayland desktop on 18.04 it seems to use XWayland as the default. So the dual Wayland/X compatible terminology terminal emulator runs in X mode by default. From terminology:
~$ echo $XDG_SESSION_TYPE
x11
FINISHED
Emacs-nox runs well in Fedora 29 (personally ran it), and Fedora 29 doesn't support X at all. By default it seems to not share the system clipboard - the same as seen in emacs-nox on Ubuntu. But emacs-nox can be modified easily enough to work with @wasamasa' s answer below and custom emacs calls to external clipboardhere and here.