DEV Community

Weather Clock Dash
Weather Clock Dash

Posted on

Firefox on Wayland: Native Support, VA-API, Screen Sharing via PipeWire

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
Enter fullscreen mode Exit fullscreen mode

Enabling Native Wayland

Method 1: Environment Variable (Temporary)

MOZ_ENABLE_WAYLAND=1 firefox
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Takes effect on next login.

Method 3: Systemd User Environment (GNOME/KDE)

systemctl --user set-environment MOZ_ENABLE_WAYLAND=1
Enter fullscreen mode Exit fullscreen mode

Or create ~/.config/environment.d/firefox-wayland.conf:

MOZ_ENABLE_WAYLAND=1
Enter fullscreen mode Exit fullscreen mode

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/
Enter fullscreen mode Exit fullscreen mode

Edit ~/.local/share/applications/firefox.desktop and change:

Exec=env MOZ_ENABLE_WAYLAND=1 /usr/lib/firefox/firefox %u
Enter fullscreen mode Exit fullscreen mode

This applies when launching Firefox from the application launcher.

Method 5: NixOS (Declarative)

environment.sessionVariables = {
  MOZ_ENABLE_WAYLAND = "1";
};
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

On KDE:

sudo apt install xdg-desktop-portal-kde
Enter fullscreen mode Exit fullscreen mode

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=fcitx environment variable

If input method isn't working:

GTK_IM_MODULE=fcitx MOZ_ENABLE_WAYLAND=1 firefox
Enter fullscreen mode Exit fullscreen mode

Sway-Specific Notes

On Sway (tiling Wayland compositor):

# ~/.config/environment.d/wayland.conf
MOZ_ENABLE_WAYLAND=1
QT_QPA_PLATFORM=wayland
SDL_VIDEODRIVER=wayland
Enter fullscreen mode Exit fullscreen mode

Sway's exec in config:

exec env MOZ_ENABLE_WAYLAND=1 firefox
Enter fullscreen mode Exit fullscreen mode

Debugging Wayland Issues

If Firefox crashes on Wayland or has visual artifacts:

  1. Try MOZ_DISABLE_CONTENT_SANDBOX=1 MOZ_ENABLE_WAYLAND=1 firefox to rule out sandbox issues
  2. Check ~/.mozilla/firefox/*.default-release/crashes/ for crash reports
  3. about:crashes in Firefox to view submitted crash reports

For rendering issues specifically:

about:config → gfx.webrender.all → true (force WebRender)
Enter fullscreen mode Exit fullscreen mode

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)