5

Following these instructions I succeeded in opening a new empty window and verified that a new wayland socket had appeared:

$ ls -alt /run/user/1000
...
-rw-------  1 craig craig 120 Oct 31 13:54 .mutter-Xwaylandauth.RN8CT0
srwxrwxr-x  1 craig craig   0 Oct 31 13:54 wayland-0
-rw-rw----  1 craig craig   0 Oct 31 13:54 wayland-0.lock
...
$ mutter --nested --wayland & 
(mutter:24172): mutter-WARNING **: 13:55:28.911: WL: unable to lock lockfile /run/user/1000/wayland-0.lock, maybe another compositor is running
$ ls -alt /run/user/1000
...
-rw-------  1 craig craig 120 Oct 31 13:55 .mutter-Xwaylandauth.M06TS0
srwxrwxr-x  1 craig craig   0 Oct 31 13:55 wayland-1
-rw-rw----  1 craig craig   0 Oct 31 13:55 wayland-1.lock
drwxr-xr-x  3 root  root   60 Oct 31 13:54 ..
-rw-------  1 craig craig 120 Oct 31 13:54 .mutter-Xwaylandauth.RN8CT0
srwxrwxr-x  1 craig craig   0 Oct 31 13:54 wayland-0
-rw-rw----  1 craig craig   0 Oct 31 13:54 wayland-0.lock
...

The new empty window looks like an empty canvas, I am pretty sure it is surface for wayland-1.

Now I try to open up a gnome-terminal in that wayland-1 canvas

WAYLAND_DISPLAY=wayland-1 gnome-terminal
WAYLAND_SOCKET=wayland-1 gnome-terminal

however in both cases it doesn't open up in the wayland-1 canvas, but instead opens up outside of it.

How to open gnome-terminal in a nested mutter(wayland) window?


EDIT: I was able to open Firefox in the nested canvas:

MOZ_DBUS_REMOTE=1 GDK_BACKEND=wayland WAYLAND_DISPLAY=wayland-1 firefox

However, replacing firefox with gnome-terminal did not work - gnome-terminal still opened outside of wayland-1.

2 Answers 2

1

The following worked for me (starting from a relatively bare-bones X11 session):

export $(dbus-launch)
mutter --nested --wayland
WAYLAND_DISPLAY=wayland-0 gnome-terminal

If you have other Wayland servers running, wayland-0 might be wayland-1 etc.

0

On some distributions gnome-terminal runs a "server" process (on Ubuntu this is done by a wrapper script which launches /usr/libexec/gnome-terminal-server - other terminals, like mate-terminal automatically launch with the --server option) which intercepts requests to open new terminal processes and launches them as as a new window within the same single server process. So when you try and launch a new terminal in your new nested session, the request is still intercepted and the gnome-terminal-server process, which is running in wayland-0, opens it as a new window within the same display it is running in, rather than the one you requested.

The best way around it is to pass a unique application ID, using the --app-id option. Like:

WAYLAND_DISPLAY=wayland-1 gnome-terminal --app-id app.x

The app.x is a "reverse DNS style indicator", so for our purposes as long as it contains two alphabetical parts, separated by a period, we are good to go. Full rules for application IDs can be found at https://developer.gnome.org/documentation/tutorials/application-id.html. If you were running two nested display servers you would need two separate app-ids, like app.x and app.y.

Some distros (such as Ubuntu) have a wrapper that runs when you run gnome-terminal, and the real gnome-terminal executable is called gnome-terminal.real. Runnning that will generate a new process, instead of a sub-window, but only if there is no gnome-terminal-server process running already (if there is it will use it and you will get the same behaviour you are trying to avoid).

There is also a --no-factory option, but that is no longer listed in the man page, and so shouldn't be expected to continue working in the future.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .