Firefox runs natively on Wayland on Linux. Switching from XWayland to native Wayland support provides benefits for smoothness, HiDPI, and security. Here's how to enable and verify it.
XWayland vs Native Wayland
When you run Firefox on a Wayland compositor (Sway, GNOME on Wayland, KDE Plasma on Wayland) without explicit configuration, it may run through XWayland — the X11 compatibility layer.
XWayland: Firefox runs as an X11 application, translated through XWayland to display on Wayland. Works but adds translation overhead.
Native Wayland (MOZ_ENABLE_WAYLAND): Firefox talks directly to the Wayland compositor. Supports proper HiDPI fractional scaling, smoother animations, and proper clipboard/drag-and-drop.
Checking Current Mode
In Firefox address bar: about:support
Search for "Window Protocol" — you'll see either:
-
wayland— native Wayland ✓ -
x11— using XWayland
Or in the terminal:
# Check if Firefox is using Wayland
ps aux | grep firefox
# If you see MOZ_ENABLE_WAYLAND=1 in env, it's native Wayland
Enabling Native Wayland
Method 1: Environment Variable (Temporary)
MOZ_ENABLE_WAYLAND=1 firefox
This starts a single Firefox instance with native Wayland. Good for testing.
Method 2: Per-User Environment Variables
Add to ~/.profile or ~/.bash_profile:
export MOZ_ENABLE_WAYLAND=1
Takes effect on next login.
Method 3: Systemd User Environment (GNOME/KDE)
systemctl --user set-environment MOZ_ENABLE_WAYLAND=1
Or create ~/.config/environment.d/firefox-wayland.conf:
MOZ_ENABLE_WAYLAND=1
Method 4: Desktop File Override
# Create a local override for the Firefox desktop entry
mkdir -p ~/.local/share/applications
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/
Edit ~/.local/share/applications/firefox.desktop and change:
Exec=env MOZ_ENABLE_WAYLAND=1 /usr/lib/firefox/firefox %u
This applies when launching Firefox from the application launcher.
Method 5: NixOS (Declarative)
environment.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
};
Modern Firefox (115+): Auto-Detection
Starting with Firefox 115+, if you're running on a Wayland session, Firefox detects it and uses native Wayland automatically without needing MOZ_ENABLE_WAYLAND=1.
You can verify: about:support → Window Protocol should show wayland.
If it still shows x11 on a Wayland session, you may be running in a mixed environment (e.g., launched from XDG_SESSION_TYPE=x11 parent) or using an older Firefox package.
VA-API on Wayland
Hardware video acceleration on Wayland:
about:config → media.ffmpeg.vaapi.enabled → true
For Intel GPUs, install intel-media-driver (Fedora/Arch) or libva-intel-driver (Ubuntu).
After enabling, verify in about:support:
- Media section → "Software rendering": should say false
- Or GPU section → "HW_COMPOSITING": Available, enabled
WebRTC on Wayland
WebRTC screen sharing has historically had issues on Wayland. Firefox uses PipeWire for screen capture on Wayland (as of Firefox 116+).
Required: PipeWire + xdg-desktop-portal installed.
On GNOME:
sudo apt install xdg-desktop-portal-gnome pipewire wireplumber
On KDE:
sudo apt install xdg-desktop-portal-kde
After installing the portal, restart Firefox. Screen sharing in Google Meet, Jitsi, etc. should work via a native Wayland picker dialog.
Fractional Scaling
On HiDPI displays with fractional scaling (e.g., 150% or 125%), native Wayland Firefox renders correctly.
With XWayland, fractional scaling can appear blurry because X11 doesn't natively support fractional DPI — it scales up a 100% bitmap, which is blurry.
On native Wayland, Firefox respects the compositor's fractional scale directly, rendering text and UI crisply.
Input Methods (IBus/Fcitx)
For CJK input methods:
- IBus: Works with native Wayland Firefox (IBus has Wayland support)
- Fcitx5: Works with
XMODIFIERS=@im=fcitxenvironment variable
If input method isn't working:
GTK_IM_MODULE=fcitx MOZ_ENABLE_WAYLAND=1 firefox
Sway-Specific Notes
On Sway (tiling Wayland compositor):
# ~/.config/environment.d/wayland.conf
MOZ_ENABLE_WAYLAND=1
QT_QPA_PLATFORM=wayland
SDL_VIDEODRIVER=wayland
Sway's exec in config:
exec env MOZ_ENABLE_WAYLAND=1 firefox
Debugging Wayland Issues
If Firefox crashes on Wayland or has visual artifacts:
- Try
MOZ_DISABLE_CONTENT_SANDBOX=1 MOZ_ENABLE_WAYLAND=1 firefoxto rule out sandbox issues - Check
~/.mozilla/firefox/*.default-release/crashes/for crash reports -
about:crashesin Firefox to view submitted crash reports
For rendering issues specifically:
about:config → gfx.webrender.all → true (force WebRender)
WebRender (Firefox's GPU-accelerated renderer) works well on native Wayland.
Firefox's Wayland support is now mature enough that it should be the default on Wayland systems. The auto-detection in Firefox 115+ handles most cases transparently.
Top comments (0)