OpenXR Loader: How to select runtime

Using the xr loader by khronons, how can one select the VR runtime and how can he list them? I’m experimenting with Monado next to SteamVR and manually changing the runtime file on disk is quite annoying and not user friendly.

The in depth descriptions are here: OpenXR® Loader - Design and Operation [DRAFT] (with all published extensions).
Under “Runtime Enumeration” there is a description on how all installed runtimes can be enumerated but there is no information out there which runtimes actually follow this part of the design.

The short version is:

On Linux the lowest priority is the active_runtime.json file in system wide xdg directories such as

ln -sf ~/monado/build/openxr_monado-dev.json /etc/xdg/openxr/1/active_runtime.json
ln -sf ~/.steam/steam/steamapps/common/SteamVR/steamxr_linux64.json ~/.config/openxr/1/active_runtime.json

The xdg directory in the user’s home directory takes precedence so that any user can override system wide settings locally. Noteworthy is that this does not apply to applications run with sudo/suid or that have capabilities allowing them elevated privileges, e.g. if you ran setcap cap_sys_nice+ep on an executable (this mirrors the behavior of the vulkan loader and icd files in ~/.config/vulkan/icd.d).

ln -sf ~/monado/build/openxr_monado-dev.json ~/.config/openxr/1/active_runtime.json
ln -sf ~/.steam/steam/steamapps/common/SteamVR/steamxr_linux64.json ~/.config/openxr/1/active_runtime.json

Lastly the environment variable XR_RUNTIME_JSON takes the highest priority.

XR_RUNTIME_JSON=~/monado/build/openxr_monado-dev.json
XR_RUNTIME_JSON=~/.steam/steam/steamapps/common/SteamVR/steamxr_linux64.json

On windows there’s also the registry involved.

There also are some independent GUI tools not developed or endorsed by Khronos:

That’s basically the state of things as it is now.

The last thing that should be mentioned is that the environment variable XR_LOADER_DEBUG=all will cause the loader to output some information about the runtime loading process.

So applications have no control over it. That’s a bummer. But the env variable version at last allows some easier testing.

Yeah for development, the environment variable is the way to go. The idea is that in general the app shouldn’t be in control of it: on Windows, runtimes set themselves as active when they detect the hardware being used. I’m not aware of any such auto-setting on Linux yet but it could be plausible.

You could use the “alternatives” system in Debian to switch runtimes too, if you’re installing Monado from apt. You’d just need to use update-alternatives to add an entry from SteamVR, then switch priority with update-alternatives or galternatives when you want to switch.