How to easily determine if an app runs on XWayland or on Wayland natively
With Fedora 24 shipping a fully working GNOME on Wayland session, Wayland has suddenly become quite usable and real. The first question that comes up after “Why Wayland anyway?” is “What apps are actually using Wayland, and what are running in the compatibility mode (via XWayland)?”
If you search the web for the title of this post, you’ll find two posts that instruct you to use Looking Glass, the GNOME Shell’s integrated debugger and inspector, and a Wiki page that lists many methods.
The easy and fun method I’ve just stumbled across is to use xeyes:
TL;DR Launch xeyes and move mouse over a window. If the eyes are moving, it’s an XWayland window, otherwise it’s a native Wayland window.
xeyes is a part of X11 demo apps that ship with almost any OS that ships X itself (you may need to install some package in your package manager to get it though).
xeyes uses X11 features to get updates about the mouse position and achieve its cool effect. On Wayland, however, there’s no way for a client to know anything that’s going on outside of its own borders, because Wayland is designed with isolation and security in mind. No app can snoop on the mouse pointer when the mouse is not over it. Because of this, an app like xeyes wouldn’t be able to run in a pure Wayland environment.
Here’s where XWayland comes into play. It’s an X Server that proxies its output via the Wayland compositor, letting you use X-only apps (including xeyes) in your Wayland session. For its clients — X-only apps — XWayland is an X Server they connect to; so they may use the usual tools to inspect (and modify) the environment.
But XWayland itself is just a client to the Wayland compositor, hence it has to obey the security limitations. In particular, it has no way to know (and report back to the clients) where the mouse is, unless it’s on top of one of its own windows. And what are its windows? Its clients’ windows.
When you launch xeyes, it connects to the XWayland server and asks for the mouse position. If the mouse is currently over a window of an app that uses XWayland, XWayland knows the mouse position and can report it back to xeyes via the X11 protocol. But if the mouse is over a native Wayland client, XWayland can’t get that — so the eyes will remain still even if you move your mouse.
This gives you a simple way to see what an app is actually using. My own testing on Fedora 24 shows that:
- All GNOME apps use Wayland
- Both Chrome and Firefox use XWayland
- So do Electron-based apps, e.g. Atom
- LibreOffice uses Wayland
- Blender uses XWayland
- Wine uses XWayland
- Telegram uses XWayland
Hopefully some of the apps that require XWayland now will support Wayland natively soon.
This post includes the word “Wayland” 17 times and the word “XWayland” 16 times.