Skip to content

Instantly share code, notes, and snippets.

@iwalton3
Created July 5, 2020 13:23
Show Gist options
  • Save iwalton3/693dafd155b5ca6617bf1ff4b70cc621 to your computer and use it in GitHub Desktop.
Save iwalton3/693dafd155b5ca6617bf1ff4b70cc621 to your computer and use it in GitHub Desktop.
Allows rapid adjustment of SteamVR IPD setting for people out of the design range of VR headsets. Just add an entry under "presets" for each user.
# IPD Adjust
# Allows rapid adjustment of SteamVR IPD setting for people out
# of the design range of VR headsets.
import json
import time
config = r"C:\Program Files (x86)\Steam\config\steamvr.vrsettings"
# Units for IPD adjustment are in mm.
presets = [
("Default", 0),
("Example User", 4)
]
data = {}
with open(config, 'r') as fh:
data = json.load(fh)
print("Current Value: {0} mm".format(int(data["steamvr"].get("ipdOffset", 0) * 1000)))
print("New Value: ")
for i, (preset, value) in enumerate(presets):
print(" [{0}] {1}: {2} mm".format(i, preset, value))
selection = input("Selection: ")
try:
selection_id = int(selection)
if selection_id < len(presets):
preset, value = presets[selection_id]
print("Selected: {0}: {1} mm".format(preset, value))
data["steamvr"]["ipdOffset"] = value / 1000
with open(config, 'w') as fh:
json.dump(data, fh)
print("Configuration saved successfully.")
else:
print("Selection {0} does not exist.".format(selection_id))
except ValueError:
print("Selection {0} was invalid.".format(selection))
time.sleep(1.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment