diff --git a/plugins/decky-vault/main.py b/plugins/decky-vault/main.py index 12747a1..8a01439 100644 --- a/plugins/decky-vault/main.py +++ b/plugins/decky-vault/main.py @@ -190,7 +190,8 @@ class Plugin: config_content = """\ # DeckyVault MangoHud logging config output_folder=/tmp -autostart_log=0 +control=mangohud +autostart_log=1 fps frame_timing cpu_power @@ -233,20 +234,17 @@ benchmark_percentiles=97,AVG,1,0.1 return {"success": False, "error": str(e)} async def stop_mangohud_logging(self) -> dict: - """RPC: Stop MangoHud logging via mangohudctl.""" + """RPC: Stop MangoHud logging via mangohudctl. Best-effort, may fail if game already closed.""" import subprocess try: result = subprocess.run( ["mangohudctl", "set", "log_session", "false"], - capture_output=True, text=True, timeout=5 + capture_output=True, text=True, timeout=2 ) if result.returncode == 0: return {"success": True} - else: - return {"success": False, "error": result.stderr.strip() or "mangohudctl failed"} - except FileNotFoundError: - return {"success": False, "error": "mangohudctl not found. Is MangoHud running?"} - except Exception as e: + return {"success": False, "error": result.stderr.strip() or "mangohudctl failed"} + except (subprocess.TimeoutExpired, FileNotFoundError, Exception) as e: return {"success": False, "error": str(e)} async def _find_mangohud_log(self) -> str | None: diff --git a/plugins/decky-vault/src/index.tsx b/plugins/decky-vault/src/index.tsx index 7167c55..a26c72c 100644 --- a/plugins/decky-vault/src/index.tsx +++ b/plugins/decky-vault/src/index.tsx @@ -14,6 +14,7 @@ import { readAndParseMangohudLog, clearMangohudLog, writeMangohudConfig, + stopMangohudLogging, getHardwareInfo, getOsVersion, getProtonVersion, @@ -80,6 +81,8 @@ function Content() { // ── Handle stop recording: parse log + read system info ──────── async function handleStop() { try { + // Try to stop MangoHud logging (best-effort, may fail if game already closed) + await stopMangohudLogging() stopRecording() // Parse the MangoHud log