diff --git a/src/atomic-xr/steamvr-lh.nu b/src/atomic-xr/steamvr-lh.nu --- a/src/atomic-xr/steamvr-lh.nu +++ b/src/atomic-xr/steamvr-lh.nu @@ -17,7 +17,7 @@ export def calibrate [] { # TODO: Support using native steam installation log warning "This is intended for Flatpak Steam, if you're using native Steam, please use Envision instead." - log warning "If you'd like to see native Steam functionality in AtomicXR, please open an issue on Tangled." + log warning "If you'd like to use this feature with native Steam, please open an issue on Tangled." if (ask yn "Do you own a lighthouse-tracked HMD? (e.g. Index, Vive Pro)") { input -sn 1 "Please connect your headset and place it on the floor, then press any key to start the calibration." @@ -44,7 +44,7 @@ if not ("~/.steam/root/config/lighthouse/" | path exists) { error make { msg: "Could not find lighthouse configuration directory." - help: "Make sure you have SteamVR installed, and .steam points to the correct location. You may need to select \"Symlink .steam directory\" in `axr icfg` if you're using the Steam Flatpak." + help: "Make sure you have SteamVR installed, and .steam points to the correct location. You may need to run `axr flatpak steam enable-xr` if you're using the Steam Flatpak." } } @@ -60,15 +60,33 @@ } } +# Run lighthouse console natively or via flatpak depending on which is installed +def lh-console [...args]: any -> any { + if (which lighthouse_console | length) > 0 { + log debug "Running lighthouse_console from PATH" + run-external lighthouse_console + } else if not ("~/.steam" | path exists) and ( + "~/.var/app/com.valvesoftware.Steam/.steam/root/steamapps/common/SteamVR/tools/lighthouse/bin/linux64/lighthouse_console" + | path exists + ) or (ls -lD ~/.steam).0.target == ("~/.var/app/com.valvesoftware.Steam/.steam/" | path expand) { + log debug "Running lighthouse_console from steam flatpak" + flatpak run --command=$"($env.HOME)/.var/app/com.valvesoftware.Steam/.steam/root/steamapps/common/SteamVR/tools/lighthouse/bin/linux64/lighthouse_console" com.valvesoftware.Steam ...$args + } else if ("~/.steam" | path exists) { + log debug "Running lighthouse_console from steam native" + run-external $"($env.HOME)/.steam/root/steamapps/common/SteamVR/tools/lighthouse/bin/linux64/lighthouse_console" ...$args + } else { + error make { + msg: "Could not find lighthouse_console" + help: "Please make sure SteamVR is installed" + } + } +} + # Open SteamVR's lighthouse_console # # Useful for pairing, dumping device configs, etc. export def console [ ...args # Arguments to pass to lighthouse_console ] { - # TODO: Support using native steam installation - log warning "This is intended for Flatpak Steam, if you're using native Steam, please use Envision instead." - log warning "If you'd like to see this functionality in AtomicXR, please open an issue on Tangled." - - flatpak run --command=$"($env.HOME)/.steam/root/steamapps/common/SteamVR/tools/lighthouse/bin/linux64/lighthouse_console" com.valvesoftware.Steam ...$args + lh-console ...$args }