Recently Learned Firefox can use Wayland natively

You can set environment variable MOZ_ENABLE_WAYLAND=1 and it will render natively in Wayland. Also, if you want to be able to do either Wayland or X11, you can put a little conditional in your .bash_profile to set it as needed. […and yes, if I add something to a config script, I also add a commented note to myself that I put it there in case I need to “troubleshoot” later.]
.

#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc
#
# If Wayland session, then enable Wayland support in Firefox
# (added by jkmooney)
if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
    export MOZ_ENABLE_WAYLAND=1
fi

…and Firefox is downright “snappy” rendering in Wayland…

1 Like

Did you try touchpad scrolling on FF Wayland?

@JKMooney
Tip: to make the file contents more readable, you can add a line of three backtics (```) before and after the entire contents.

1 Like

it is actually not needed because firefox checks itself whether it runs on wayland and activates it accordingly.
I am setting it in
~/.config/environment.d/envvars.conf

MOZ_ENABLE_WAYLAND=1

and constantly switch between X11 and wayland without issues.

it was discussed earlier this year here:

My understanding was it used xwayland unless you set MOZ_ENABLE_WAYLAND=1 to use Wayland natively.

Updated accordingly, thanks :slight_smile:

2 Likes

I haven’t tried it lately, but last time I launched FF with wayland rendering, there were issues with some of the graphical elements not appearing in the right places (like menu bar and popup menu items (like open link in new tab). Is it still an issue or have things moved forward (from someone who has done it lately?)?

yes, but you don’t have to check if you run in wayland before applying the environment variable.

also, .bash_* might not be used for zsh/fish/all the other shell alternatives.

I’ve tried to set the environment variable in the .desktop file as described in the wiki.
When I check the Firefox entry in my start menu (KDE) I can see that the env variable is in the command, but it doesn’t work for some reason. It only works when I execute the file in /home/user/.local/share/applications/firefox.desktop directly.

Anyone has an idea why? And what’s the actual benefit to run it as a Wayland application?

And what’s the actual benefit to run it as a Wayland application?
You don’t have to run an embedded Xserver (aka Xwayland) to run it ? (thus not wasting more memory?). It should also perform better.

It’s also required if you want to enable hardware video acceleration, though to be fair I haven’t tested if it works in Xwayland as well.

Touchpad scrolling is much better. This alone is enough for me.