fix(plugin): add debug logging to check_mangohud

This commit is contained in:
2026-06-28 20:47:43 +08:00
parent 55bc86874a
commit 6a486ed257
3 changed files with 17 additions and 10 deletions
+13 -10
View File
@@ -161,22 +161,25 @@ class Plugin:
path = "/usr/bin/mangohud" path = "/usr/bin/mangohud"
exists = os.path.exists(path) exists = os.path.exists(path)
if not exists: 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 = "" version = ""
debug = ""
try: 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() v = pipe.read().strip()
if v and "-" in v: debug = f"popen got: {repr(v)}"
v = v.split("-")[0] if v:
version = v if "-" in v:
except: v = v.split("-")[0]
pass 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: 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: async def write_mangohud_config(self) -> dict:
"""RPC: Write the MangoHud logging config to ~/.config/MangoHud/MangoHud.conf. """RPC: Write the MangoHud logging config to ~/.config/MangoHud/MangoHud.conf.
@@ -112,6 +112,9 @@ export default function MainPanel({
path: result.path, path: result.path,
version: result.version, version: result.version,
}) })
if (result.debug) {
console.log("[DeckyVault] MangoHud debug:", result.debug)
}
} }
async function handleTestKey() { async function handleTestKey() {
+1
View File
@@ -10,6 +10,7 @@ export const checkMangohud = callable<[], {
path: string path: string
version: string version: string
error?: string error?: string
debug?: string
}>("check_mangohud") }>("check_mangohud")
export const writeMangohudConfig = callable<[], { export const writeMangohudConfig = callable<[], {