Skip to content

Running programs natively under Wayland

Hugo edited this page Jul 17, 2023 · 52 revisions

If your toolkit/library supports this, you can have your apps run natively (without Xwayland) by setting some environment variables (you can add them to your launcher script or a session file if you're using a display manager).

You can disable Xwayland (X clients under Wayland) support by specifying xwayland disable in your Sway config.

About this list

This article is about configuring portable applications to use Wayland natively. For a list of Wayland-native utilities, see Useful add ons for sway.

GTK3

Wayland will be selected by default. Do not set GDK_BACKEND, it will break apps (e.g. Chromium and Electron).

Experimental Wayland support in Firefox can be enabled with MOZ_ENABLE_WAYLAND=1. Firefox ESR 68 also needs the --no-remote flag because of a bug.

LibreOffice should select Wayland by default. (If not, try SAL_USE_VCLPLUGIN=gtk3.)

Qt5

Wayland is used by default if XDG_SESSION_TYPE=wayland is set (i.e. if you use a display manager). If not:

QT_QPA_PLATFORM=wayland-egl

To use your monitor's DPI instead of the default of 96 DPI:

QT_WAYLAND_FORCE_DPI=physical

Older versions of Qt always show window decorations. To hide them:

QT_WAYLAND_DISABLE_WINDOWDECORATION=1

NOTE: To enable Wayland support, you might need a package, such as qtwayland5 for Ubuntu or qt5-wayland for Arch Linux.

Elementary/EFL

ECORE_EVAS_ENGINE=wayland_egl
ELM_ENGINE=wayland_egl

You could set them to wayland_shm instead, if you want to use software rendering.

SDL

SDL3 uses native Wayland by default.

SDL2 uses Xwayland by default, so use

SDL_VIDEODRIVER=wayland

NOTE: Steam, most games and other (older) binary applications might not work with wayland SDL video driver, due to old bundled SDL library. Unset, tweak for specific applications or force newer SDL via

SDL_DYNAMIC_API=/usr/lib/libSDL2-2.0.so

SDL1 doesn't support native Wayland, so use SDL2 via sdl12-compat.

Flatpak

flatpak [--user] run --socket=wayland your-app

Or to make it the default socket either for your app or even globally:

flatpak [--user] override --socket=wayland [your-app]

GLFW

Wayland needs to be selected at compile-time. Arch users can install glfw-wayland.

GLFW >= 3.4 (not released yet) adds the ability to support both x11 and wayland and automatically detect & select one at run-time.

Java under Xwayland

Some Java AWT applications will not display properly unless you set the following.

_JAVA_AWT_WM_NONREPARENTING=1