feat: reworked env var descriptions; added lh_handtracking env var description

This commit is contained in:
Gabriele Musco 2024-08-01 11:18:59 +02:00
commit be5804315d
4 changed files with 67 additions and 75 deletions

49
Cargo.lock generated
View file

@ -289,8 +289,6 @@ dependencies = [
"libmonado-rs",
"nix",
"openxr",
"phf",
"phf_macros",
"relm4",
"relm4-components",
"reqwest",
@ -1460,47 +1458,6 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "phf"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_shared",
]
[[package]]
name = "phf_generator"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
dependencies = [
"phf_shared",
"rand",
]
[[package]]
name = "phf_macros"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
dependencies = [
"phf_generator",
"phf_shared",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "phf_shared"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
dependencies = [
"siphasher",
]
[[package]]
name = "pin-project"
version = "1.1.5"
@ -1947,12 +1904,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
[[package]]
name = "siphasher"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "slab"
version = "0.4.9"

View file

@ -15,8 +15,6 @@ libadwaita = { version = "0.7.0", features = ["v1_5"] }
libmonado-rs = { git = "https://github.com/technobaboo/libmonado-rs", rev = "ddad003d5701c7139dd0de69c8195ed2105784ca" }
rusb = "0.9.4"
nix = { version = "0.29.0", features = ["fs", "signal"] }
phf = "0.11.2"
phf_macros = "0.11.2"
relm4 = { version = "0.9.0", features = ["libadwaita"] }
relm4-components = "0.9.1"
reqwest = { version = "0.12.5", features = ["blocking"] }

View file

@ -1,29 +1,72 @@
use phf::Map;
use phf_macros::phf_map;
use lazy_static::lazy_static;
pub static ENV_VAR_DESCRIPTIONS: Map<&str, &str> = phf_map! {
"XRT_COMPOSITOR_SCALE_PECENTAGE" =>
"Render resolution percentage. A percentage higher than the native resolution (>100) will help with antialiasing and image clarity.",
"XRT_COMPOSITOR_COMPUTE" => "Set to 1 to use GPU compute for the OpenXR compositor.",
"U_PACING_APP_USE_MIN_FRAME_PERIOD" => "Set to 1 to unlimit the compositor refresh from a power of two of your HMD refresh, typically provides a large performance boost.",
"SURVIVE_GLOBALSCENESOLVER" =>
"Continuously recalibrate lighthouse tracking during use. In the current state it's recommended to disable this feature by setting this value to 0.",
// "SURVIVE_TIMECODE_OFFSET_MS" => "",
"LD_LIBRARY_PATH" =>
"Colon-separated list of directories where the dynamic linker will search for shared object libraries.",
"XRT_DEBUG_GUI" => "Set to 1 to enable the Monado debug UI.",
"XRT_CURATED_GUI" => "Set to 1 to enable the Monado preview UI. Requires XRT_DEBUG_GUI=1 to work.",
"XRT_JSON_LOG" => "Set to 1 to enable JSON logging for Monado. This enables better log visualization and log level filtering.",
"QWERTY_ENABLE" => "Set to 1 to enable QWERTY Simulation driver. This enables simulated driver that allows you to use Monado without HMD and controllers. It's also possible to mix and match different profiles with this.",
"LH_DRIVER" => "Lighthouse driver, this overrides the \"Lighthouse driver option in the profile\"; Valid options are: \"vive\" for the default built-in driver, \"survive\" for Libsurvive, \"steamvr\" for the SteamVR based implementation.",
"LH_LOG" => "Lighthouse log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\".",
"LIGHTHOUSE_LOG" => "Lighthouse driver log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\"."
};
fn env_var_descriptions() -> Vec<(&'static str, &'static str)> {
vec![
(
"XRT_COMPOSITOR_SCALE_PECENTAGE",
"Render resolution percentage. A percentage higher than the native resolution (>100) will help with antialiasing and image clarity."
),
(
"XRT_COMPOSITOR_COMPUTE",
"Set to 1 to use GPU compute for the OpenXR compositor."
),
(
"U_PACING_APP_USE_MIN_FRAME_PERIOD",
"Set to 1 to unlimit the compositor refresh from a power of two of your HMD refresh, typically provides a large performance boost."
),
(
"SURVIVE_GLOBALSCENESOLVER",
"Continuously recalibrate lighthouse tracking during use. In the current state it's recommended to disable this feature by setting this value to 0."
),
// ("SURVIVE_TIMECODE_OFFSET_MS", ""),
(
"LD_LIBRARY_PATH",
"Colon-separated list of directories where the dynamic linker will search for shared object libraries."
),
(
"XRT_DEBUG_GUI",
"Set to 1 to enable the Monado debug UI."
),
(
"XRT_CURATED_GUI",
"Set to 1 to enable the Monado preview UI. Requires XRT_DEBUG_GUI=1 to work."
),
(
"XRT_JSON_LOG",
"Set to 1 to enable JSON logging for Monado. This enables better log visualization and log level filtering."
),
(
"QWERTY_ENABLE",
"Set to 1 to enable QWERTY Simulation driver. This enables simulated driver that allows you to use Monado without HMD and controllers. It's also possible to mix and match different profiles with this."
),
(
"LH_DRIVER",
"Lighthouse driver, this overrides the \"Lighthouse driver option in the profile\"; Valid options are: \"vive\" for the default built-in driver, \"survive\" for Libsurvive, \"steamvr\" for the SteamVR based implementation."
),
(
"LH_LOG",
"Lighthouse log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\"."
),
(
"LIGHTHOUSE_LOG",
"Lighthouse driver log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\"."
),
(
"LH_HANDTRACKING",
"Controls when to enable mercury optical hand tracking. Valid options are: \"0\" (off) to disable hand tracking, \"1\" (auto) to only enable hand tracking if no controllers are found, \"2\" (on) to enable hand tracking even if controllers are found."
),
]
}
pub fn env_var_descriptions_as_paragraph() -> String {
fn env_var_descriptions_as_paragraph() -> String {
ENV_VAR_DESCRIPTIONS
.into_iter()
.iter()
.map(|(k, v)| format!(" \u{2022} <b>{}</b>: {}", k, v))
.collect::<Vec<String>>()
.join("\n\n")
}
lazy_static! {
pub static ref ENV_VAR_DESCRIPTIONS: Vec<(&'static str, &'static str)> = env_var_descriptions();
pub static ref ENV_VAR_DESCRIPTIONS_AS_PARAGRAPH: String = env_var_descriptions_as_paragraph();
}

View file

@ -3,7 +3,7 @@ use super::{
factories::env_var_row_factory::{EnvVarModel, EnvVarModelInit},
};
use crate::{
env_var_descriptions::env_var_descriptions_as_paragraph,
env_var_descriptions::ENV_VAR_DESCRIPTIONS_AS_PARAGRAPH,
profile::{LighthouseDriver, Profile, XRServiceType},
ui::{
factories::env_var_row_factory::EnvVarModelOutMsg,
@ -533,7 +533,7 @@ impl SimpleComponent for ProfileEditor {
.launch(
adw::PreferencesGroup::builder()
.title("Environment Variables")
.description(env_var_descriptions_as_paragraph())
.description(ENV_VAR_DESCRIPTIONS_AS_PARAGRAPH.as_str())
.header_suffix(&add_env_var_btn)
.build(),
)