How to run Steam on Wayland with Nvidia on hybrid GPU laptop?

I know that to run app with Nvidia, all I have to do it to add variable prime-run.

However, it is more puzzling with Steam and Wayland, especially when you have optimus-manager.

First, optimus-manager suppose to work only in X11 and that was true in the past. Whenever I chose Wayland, optimus-manager icon wasn’t showing and everything worked as expected with prime-run.

Since few months, optimus-manager shows in Wayland as if it was on X11. I thought that this is some glitch and it doesn’t work anyway, but… it does…

When I am in Intel mode, I can’t start steam like: prime-run steam
On hybrid mode prime-run steam works as expected.

To add to that mix, all is fine when I use terminal. When I want to use prime-run steam in .desktop launcher, it throws an error: “Can’t find prime-run steam program”.

So the only way is to use it separately as an argument:

However, in this setup, Steam still launches without Nvidia.

So why is it that prime-run steam works in terminal but not when prime-run is added as argument?

And why optimus-manager suddenly works in Wayland?

Skipping the dubious nature of optimus-manager in general…

Thats how it is supposed to work.
Well, besides…
You shouldnt ever be running steam with prime-run … you should be editing the launch options of the game for prime-run %command%.

Seems like the desktop file isnt properly formulated.
Generally speaking you want to use a full path.
For example here is one of the Exec lines from a firefox.desktop:

/usr/bin/sh -c "MOZ_DRM_DEVICE=/dev/dri/card0 MOZ_X11_EGL=1 GTK_USE_PORTAL=1 /usr/lib/firefox/firefox %u"
1 Like

We’ve discussed here in the past already, and I just disagree. I prefer to have steam on Nvidia and don’t think about adding parameters to game launchers. It’s simpler and cleaner that way. Besides, in full Nvidia mode it is used for all desktop and nobody is telling you to run hybrid mode just to get more juice out of Nvidia. So if it can power everything, starting Steam with Nvidia is also an OK solution. However, maybe I’ll try to test it and see if the performance is the same with one method or the other, but so far, none had proved that it does, so I stick to my preferred solution for now.

I agree, but on older cards, when I need to work on battery, it’s nice to have access to Intel mode. Otherwise, when laptop is plugged to AC, hybrid mode is all I need. I’ve been thinking of ditching optimus-manager, but sometimes I do need to work on battery, so… there is no hurry. It works fine for me. Only its nature in Wayland is puzzling, still, it’s not a problem, just confusing.

How to find out the full command? I tried:

/usr/bin/sh -C "prime-run /usr/lib/steam/steam %u"

but it shows error, although there is steam in those locations. I just don’t get the rules behind it, all the sh, -C, %u and so on.

I didnt say to copy the command shown as-is. It was an example.
(though … if you were trying to copy … the C should not be capitalized.)
%u is a variable for URL input … used by something like firefox … steam has no use for it.

There are many ways … below is which, and pacman -Ql that will list files from a package.

which prime-run
pacman -Ql nvidia-prime

From my own perusal I’m guessing what you really want is

/usr/bin/prime-run /usr/lib/steam/steam "$@"
1 Like

It works in terminal, all right. It fails if I add it to the launcher via editing it on Plasma. In the past it worked exactly like in terminal, but they updated it, added this “attribute” box, and it no longer works. I can’t use the launching command, when adding to attribute it also fails to apply the attribute. It feels that I’m missing something. This is a great example of an “upgrade” that was supposed to add an improvement, just made it more complicated and obscure.

Is there any Plasma user that knows how to make it work? No matter what attribute I add, it simply doesn’t apply it.

I know I could edit the .desktop file directly, but for the convenience sake, I want to know how to use it via GUI, just for the future reference.

By this are you referring to your screenshot of Lattedock’s launcher settings?

Oh I see, it was just started from lattedock.

I also suspect you are not using it as intended … the ‘argument’ section is likely pertaining to flags used after such as Program: inxi ; Argument: -Fazy

To use the firefox.desktop example again… see this ‘properties’ screenshot:

So in your case, and throwing in the sh method

Program: /usr/bin/sh
Arguments: -c '/usr/bin/prime-run /usr/lib/steam/steam "$@"'

The program launcher is itself launched from the dock, hence all the properties windows are showing as latte. That shouldn’t have any impact on anything.

OK, so you are saying the attribute in this case is what usually is put AFTER, not BEFORE?

Yes, got it! You were right! The attribute field didn’t work, because there is another field named “environmental variables” and that is what I was supposed to use in the first place. Duh! The name say is all, but because it was translated to my language, I just didn’t notice it.

Here it is how I set it and how it works:

Weirdly, when I save it, it moves “steam” into the arguments and the “prime-run” as the program… This may be a bug, but works nevertheless, because the order is kept.

And I could keep it simple, without those full paths or whatnot.

Its not entirely nonsensical for it to be placed in the ‘environment variable’ section as those do go before the execution.
While prime-run is treated as a script in and of itself … technically prime-run is really just a collection of env vars. In particular it looks like this:

#!/bin/bash
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"
1 Like

I prefer to remember it simple, just ‘prime-run’.

Thank you for helping me find the solution. In the end, it was not about Wayland, but the proper setting of a KDE launcher editor. Simple, but I was blind to it…

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