I'm testing GNOME 3.14 on Wayland on ArchLinux and I would also like to test GTK+ on Wayland. To do so, I can set the following two env variables from terminal

export GDK_BACKEND=wayland CLUTTER_BACKEND=wayland

anf then run my app (i.e. nautilus) from terminal too. However I would like to set this session-wide so that I don't have to launch my apps from terminal. I think I cannot set them on .bashrc because they will break my standard GNOME on X session.

So where is the proper place to set those variables for GNOME on Wayland session ONLY?

  • See unix.stackexchange.com/a/403196/23305 for setting session-wide environment variables under Gnome Wayland. In short, ~/.config/environment.d/. That said, I'm not sure there's a way to conditionally set variables. There is ${:-} and ${:+} substitution syntax that might be able help? – Jack O'Connor Nov 7 '17 at 23:30

I have found a way to do this.

Create (if necessary) a ~/.profile file and add the following:

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

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

Logout and then login in your favorite session (either X or Wayland). By using looking glass you can check if your application is actually running on Wayland. See this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.