How to add gamemoderun to Steam flatpak?

I have tried editing the application startup commands, but it gives me error for not having rights to do so.

So i have opened application menu searched for Steam and then right clicked it and pressed Edit application. There im not able to save it. Is there a way to open it with sudo rights or how could i add gamemoderun to be launched every time when Steam opens?

With kmenuedit it does not save the changes to the application even when i press save. I can’t run kmenuedit with sudo.

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’
kf.i18n: KLocalizedString: Using an empty domain, fix the code. msgid: “KDE Menu Editor” msgid_plural: “” msgctxt: “”
kf.dbusaddons: DBus session bus not found. To circumvent this problem try the following command (with bash):
export $(dbus-launch)

I might guess this is specifically because you are usingthe flatpak.
Its meant to be ‘containerized’.

Sounds like you were trying to edit the steam .desktop file directly?
That will not be allowed without root/sudo … and probably should not be done at all.
Normally to overwrite (or add) some things in a .desktop file we would

  • Copy the .desktop file to HOME, ex:
    cp /usr/share/applications/steam.desktop ~/.local/share/applications/
  • Edit the desktop file
    micro ~/.local/share/applications/steam.desktop

Though this is also odd.

I think this should be set - here it is.

$ echo $XDG_RUNTIME_DIR
/run/user/1000

And this

Does this mean something is wrong with your dbus in general?
Maybe something to do with the switch to dbus-broker a while ago?

Im trying to edit com.valvesoftware.Steam, so yes the Flatpak of Steam.

I can just do gamemoderun com.valvesoftware.Steam from the terminal, but how can i make that happen with the gui?

Maybe something is wrong with my dbus cause with Steams flatpak it does not prevent screen lock???

Normally we would prefer to edit the game’s launch options.

Using %command% for a stand-in of the game itself.

Something like

gamemoderun %command%

Have you not tried that yet?

As for augmenting the desktop file in general … I already outlined how to do that above…

I personally want to enable gamemode by default for running steam and not individually for each game.

Weird. I don’t have steam.desktop in /usr/share/applications.

That is the normal path of the repository package.

You mentioned it is not the same.

So … that one.

That is also not there. Kind of stumped now. :smiley:
I do have the icons in my panel and app menu and those work fine.

If its a flatpak it could have installed in other places.

/opt/ in some cases.

But probably /var/lib/flatpak/app in this one.

Here is a random thread on the places you might find flatpak desktop files:

EDIT.
I never use flatpak, but it appears this might be a way to find exactly where something is;

flatpak info --show-location com.valvesoftware.Steam

I found a .desktop file in /var/lib/flatpak/app/com.valvesoftware.Steam/x86_64/stable/173cd565d98d4951bd858bad290e8481a9e72dbf5f7c9c980165a060666184b1/files/share/applications/

Now there is line Exec=steam steam://open/friends
or
Exec=/app/bin/steam %U

How do i edit it to have gamemoderun?

After copying it to ~/.local/share/applications
Edit the Exec line to include gamemoderun

Exec=gamemoderun /app/bin/steam %U

Though full paths are probably best

Exec=/usr/bin/gamemoderun /app/bin/steam %U

But also sometimes we might need to give the parser a little help and run it as a shell command
(especially useful with older/minimal utilities like xfce autostart or to add environment variables)

Exec=/usr/bin/sh -c "/usr/bin/gamemoderun /app/bin/steam %U"

Thanks. The last line

Exec=/usr/bin/sh -c "/usr/bin/gamemoderun /app/bin/steam %U"

Works

Glad to hear it. Happy linuxing.

There is one issue with it though. When i make a panel icon from it. It does not launch for some reason unknown to me. I did sort of jank fix it by making sh script that starts gamemode and steam and pointing that to the panel icon.

With the overriding .desktop file in place it should supplant other iterations of ‘normal’ launching it.
That is - from your desktop application menu etc, just the regular “Steam” entry should now use gamemoderun.
There should be no need to explicitly use the new .desktop file when, for example, pinning the app to the panel. Conversely it should not be a problem to use it either.

Using a start script is also an acceptable solution if you need to do that for whatever reason.

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