Bash – Real GNOME Wayland session

bashgnomewayland

I'm trying to test a "real" wayland gnome session. I know that not all applications can run on Wayland natively (for this we have XWayland) but at least I would like to have GTK+ applications to do so.

So, I created a ~/.profile file containing

export GDK_BACKEND=wayland
export CLUTTER_BACKEND=wayland

>>> Edit: instead of contents above, you may add this to ~/.profile in order to make it work for both X and Wayland sessions:

WAY=$(ps -aux | head -n -1 | grep "/usr/bin/gnome-shell --wayland")

if [ -z "$WAY" ]; then
    echo X11
else
    export GDK_BACKEND=wayland
    export CLUTTER_BACKEND=wayland
fi

<<<

Then from my GDM login screen (Archlinux) I select gnome on wayland.

Once ready, I start (for example) nautilus (normally from the dash, not from terminal), then I open looking glass, I select "windows" section and I click on nautilus window and I get GType:MetaWindowWayland which tells me that Nautilus is actually running on Wayland instead of XWayland. Super!

GType:MetaWindowWayland

However, if, again from looking glass, I select gnome-sell entry, I get GType:MetaWindowX11 telling me that the shell is running on XWayland.

GType:MetaWindowX11

Mutter seems to be running on Wayland (as for example the clipboard between X and W still does not work), all the GTK+ app that I launch after login are running on Wayland too (GType:MetaWindowWayland) however gnome-shell is still on X11.

My guess is that gnome-shell does not take into consideration ~/.profile while starting the session. Maybe because it is started by the system not by the user?
So maybe I have to add

export GDK_BACKEND=wayland
export CLUTTER_BACKEND=wayland

somewhere else?

Best Answer

I think you have to add that to .bashrc which also works for non-login shells.