Wire wrist placement settings through config and installer

This commit is contained in:
baketnk committed 2026-09-24 14:46:24 -04:00
1 parent 569ba13830
commit e61bf733f9
9 files changed
+80 -6

No files matched your search

+8
View File
@@ -23,6 +23,7 @@ DIGEST_RE = re.compile(r"[a-fA-F0-9]{64}\Z")
CONFIG_DEFAULTS = {
"font": "",
"input_priority": "normal",
"wrist": {"x": 0, "y": 0.18, "z": 0.089, "width": 0.30, "roll_degrees": 0},
"theme": {"background": "#0c101b", "card": "#141c2b", "ink": "#e6f0f9",
"muted": "#97adc1", "accent": "#1ff0a4", "warning": "#ff6e87",
"frame_start": "#1fff91", "frame_end": "#1f70ff"},
@@ -79,6 +80,13 @@ def normalized_config(data):
fixed = {"font": data.get("font") if isinstance(data.get("font"), str) else ""}
priority = data.get("input_priority", "normal")
fixed["input_priority"] = priority if priority in ("normal", "experimental") else "normal"
source = data.get("wrist")
source = source if isinstance(source, dict) else {}
fixed["wrist"] = {}
for name, default in CONFIG_DEFAULTS["wrist"].items():
value = source.get(name, default)
limit = (.15, .6) if name == "width" else (-180, 180) if name == "roll_degrees" else (-.3, .3)
fixed["wrist"][name] = value if type(value) in (int, float) and limit[0] <= value <= limit[1] else default
for section in ("theme", "buttons"):
source = data.get(section)
source = source if isinstance(source, dict) else {}