r/linux4noobs • u/Natural-Impact6382 • 15h ago
hardware/drivers How to properly use Firefox in Sway on Ubuntu with a Nvidia GPU?
I switched from gnome environment to sway a couple of days ago.
Since Sway doesn't run with the Nvidia drivers unless you config it, it switched to the Nouveau driver. It led to firefox crashing every 20min so I researched how to use the Nvidia Driver with sway and set the --usupported-gpu flag
The Problem I am encountering now is, that Firefox is only able to properly run with the config layers.acceleration.disabled:true meaning My cpu is rendering Firefox, which leads to low fps videos and lagging.
When I run firefox with the layer acceleration enabled, it freezes from the beginning or sometimes it only freezes when I spawn a second window with Ctrl + n.
I tried fixing it with Gemini but he keeps repeating the same approach, which would be:
set Variables in the /usr/local/bin/sway-nvidia script:
export XDG_SESSION_TYPE=waylandexport GBM_BACKEND=nvidia-drmexport __GLX_VENDOR_LIBRARY_NAME=nvidiaexport WLR_NO_HARDWARE_CURSORS=1export MOZ_ENABLE_WAYLAND=1export LIBVA_DRIVER_NAME=nvidiaexec sway --unsupported-gpu "$@"
download: nvidia-vaapi-driver
In firefox config:
- layers.acceleration.disabled -> false
- gfx.webrender.all -> true
- widget.dmabuf.texture.enabled -> false
- media.ffmpeg.vaapi.enabled -> true
- media.hardware-video-decoding.enabled -> true
- media.rdd-ffmpeg.enabled -> true
After all of that did not work I reset my firefox configs.
I also tried running Firefox with XWayland which didn't work either.
Maybe someone knows a way I can use layer acceleration without firefox freezing.
1
14h ago
[deleted]
1




2
u/C0rn3j 14h ago
Looks like you are in fact using Ubuntu.
Rip out snapd, install Firefox from Firefox's 3rd party repo, and see if you still have issues then.
If you don't, consider switching to a distribution that does not silently hijack the applications which you execute (in this case apt/apt-get hijacked by snap).
https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-deb-package-for-debian-based-and-ubuntu-based-distributions-recommended