fix(plugin): add control socket, autostart_log=1, timeout-safe mangohudctl

This commit is contained in:
2026-06-28 20:33:12 +08:00
parent aa52e0feb6
commit 37cc24ff60
2 changed files with 9 additions and 8 deletions
+6 -8
View File
@@ -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:
+3
View File
@@ -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