Cannot set programmatically "launch options" environment variables
Hi, before you read, consider that my end goal is to create a helper script for the community to provide easily more apitraces to Pierre-Loup Griffais / Doitjutsin =)
1st idea: set the variable through the URI protocol i'd like to start by a command my game with set ENV variables (for apitracing proton/dxvk) through the URI protocol or another mean. eg.
PROTON_LOG=1 DXVK_HUD=fps,frametimes WINEDLLOVERRIDES="dxgi,dxgitrace,d3d11,d3d10,d3d9=n,b" xdg-open steam://rungameid/$id/$arguments
It's not possible at the moment.
To run it programmatically, i either have to restart Steam with the ENV variables set, or manually go click for each game to set the launch options.
2nd idea: reload localconfig.vdf on the run to set launch options Also, i was thinking about modifying the "LaunchOptions" value in the localconfig.vdf but the client doesn't read it once it's been launched (see https://github.com/ValveSoftware/steam-for-linux/issues/6121#issuecomment-483008707). Is there a way to for the Steam client to read the newly modified localconfig.vdf ? Can the following API command provide this feature ? (haven't tried it because it seems hazardous)
steam://flushconfig/
Flushes and reloads the configs for each application (beta availability, etc.)
That would solve my issue.
Thanks in advance.
Seconded. Same use case. The ability to auto-install an accessibility launcher would be quite nice.
Still not implemented...
Is anyone ever going to implement this? It has been almost 6 years.
+1. My use case is that I want to pass WAYLANDDRV_PRIMARY_MONITOR to games I start through Sunshine, to make games launch on a headless display rather than launching on my primary physical monitor.
Maybe just having steam:// commands pick up envvars from the context they're called in, or even a flag type thing like steam steam://rungameid/1234 --env VAR1=x VAR2=y that can be used to pass in envvars?
FYI for others in similar situation: as the OP suggests, right now I have a convoluted launch script that quits and relaunches Steam itself with that envvar set, which then makes games inherit the envvar from Steam when launched with steam://rungameid/1234
+1
This feature already exists in the UI in %command% substitution, it's just a matter of exposing it in the command line. This way, not only envvars can be set, but also wrappers such as gamescope can be configured
Almost 2026, still not implemented btw.
I found an interesting solution for this (no idea why I didn't think of it, it seems so obvious in hindsight!) courtesy of some nvidia gaming docs:
- Create a shell script in
/usr/local/bin, e.g.steam-wrapper, that exports any envs you want. Example script content:
#!/usr/bin/bash
# export any environment variables here
export PROTON_LOG=1
export PROTON_ENABLE_WAYLAND=1
# exported variables, now execute the command
exec "$@"
- In steam game launch options, use that wrapper script like so:
steam-wrapper %command% - Now, whenever you want to programmatically change exported vars, just change the contents of the
steam-wrapperscript viasedor similar, no need to edit the game launch options or restart steam or any of that.
thank you so much for your solution @ssareta reloading dynamically localconfig.vdf would be much more intuitive, but your wrapper solution is even more useful I'm still experimenting with this, but it's so much simple to automate stuff I do it particularly for ultrawide and framegen, which I can choose to disable/enable for specific game with shortcuts and, without having to go through the UI every time