Starting a program in Gnome with the open source nvidia driver

I just switched to the Gnome desktop, I have two video cards in my computer. One is intel and the other is nvidia. The closed source driver for my nvidia card does not work with wayland, so I use the open source driver. When I start a program from the terminal by typing DRI_PRIME=1 in front of it, it works with the external video card, but I want that application to work with the external video card by default. Following the instructions on the Manjaro wiki, I copied the /usr/share/application/firefox.desktop file to /home/$username/.local/share/applications/ and went in and changed Exec=/usr/lib/firefox/firefox %u to Exec=DRI_PRIME=1 /usr/lib/firefox/firefox %u. But firefox does not start with the external video card. I did the same in the original file but it doesn’t start with the external video card. How can I set firefox to work with external video card when I click on it?
Sorry for my bad English :slight_smile:

There are several mistakes in here - which may or may not be typos.
usr/share/application/firefox.desktop should be

but more importantly:
/local/share/application/ … doesn’t exist

What you mean is likely:
(the “hidden” directory ~/.local in your $HOME)

Thanks I’ve edited the post now.Any idea how I can start firefox with an external card?

No idea.
Like you, I would have expected it to work.
Neither do I run Gnome, nor do I have two graphics cards to choose from.
I cannot test anything I might come up with and thus cannot help you.

Not quite right.

Do it like so:

Exec=/usr/bin/sh -c "DRI_PRIME=1 /usr/lib/firefox/firefox --private-window %u"

(etc, for all the exec lines)

Notice we call the shell to quote our environment variables and execution string.

Though … I’m not sure I would want to launch FF with the dGPU … and if I did want that with an nvidia … I would probably not launch firefox using wayland.

Also note … there are numerous other env vars for FF depending on what you are doing.

This should be used if you are trying to launch firefox with wayland:


This can help with hardware acceleration … but you need the correct device path:

1 Like
Exec=/usr/bin/sh -c "DRI_PRIME=1 /usr/lib/firefox/firefox --private-window %u"

It worked when I rebooted.Thanks

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.