From 6a486ed25709138df111a65e55b139fc47c2d68e Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Sun, 28 Jun 2026 20:47:43 +0800 Subject: [PATCH] fix(plugin): add debug logging to check_mangohud --- plugins/decky-vault/main.py | 23 +++++++++++-------- .../decky-vault/src/components/main-panel.tsx | 3 +++ plugins/decky-vault/src/lib/api.ts | 1 + 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/plugins/decky-vault/main.py b/plugins/decky-vault/main.py index d6b16d0..48e6b2d 100644 --- a/plugins/decky-vault/main.py +++ b/plugins/decky-vault/main.py @@ -161,22 +161,25 @@ class Plugin: path = "/usr/bin/mangohud" exists = os.path.exists(path) if not exists: - return {"installed": False, "path": "", "version": ""} + return {"installed": False, "path": "", "version": "", "debug": "file not found"} - # Get version using os.popen (more reliable than subprocess in some envs) + # Get version using os.popen version = "" + debug = "" try: - with os.popen(f"{path} --version 2>/dev/null") as pipe: + with os.popen(f"{path} --version 2>&1") as pipe: v = pipe.read().strip() - if v and "-" in v: - v = v.split("-")[0] - version = v - except: - pass + debug = f"popen got: {repr(v)}" + if v: + if "-" in v: + v = v.split("-")[0] + version = v + except Exception as e: + debug = f"popen error: {str(e)}" - return {"installed": True, "path": path, "version": version} + return {"installed": True, "path": path, "version": version, "debug": debug} except Exception as e: - return {"installed": False, "path": "", "version": "", "error": str(e)} + return {"installed": False, "path": "", "version": "", "error": str(e), "debug": "outer error"} async def write_mangohud_config(self) -> dict: """RPC: Write the MangoHud logging config to ~/.config/MangoHud/MangoHud.conf. diff --git a/plugins/decky-vault/src/components/main-panel.tsx b/plugins/decky-vault/src/components/main-panel.tsx index 4774ca8..771cecc 100644 --- a/plugins/decky-vault/src/components/main-panel.tsx +++ b/plugins/decky-vault/src/components/main-panel.tsx @@ -112,6 +112,9 @@ export default function MainPanel({ path: result.path, version: result.version, }) + if (result.debug) { + console.log("[DeckyVault] MangoHud debug:", result.debug) + } } async function handleTestKey() { diff --git a/plugins/decky-vault/src/lib/api.ts b/plugins/decky-vault/src/lib/api.ts index 2225247..e5340f0 100644 --- a/plugins/decky-vault/src/lib/api.ts +++ b/plugins/decky-vault/src/lib/api.ts @@ -10,6 +10,7 @@ export const checkMangohud = callable<[], { path: string version: string error?: string + debug?: string }>("check_mangohud") export const writeMangohudConfig = callable<[], {