feat(plugin): restructure layout like LSFG-VK, use mangohudctl for logging

This commit is contained in:
2026-06-28 20:21:33 +08:00
parent c230367d14
commit 6e1957524b
4 changed files with 441 additions and 81 deletions
+34 -1
View File
@@ -192,7 +192,6 @@ class Plugin:
# DeckyVault MangoHud logging config
output_folder=/tmp
output_file=deckyvault-mangohud.log
autostart_log=0
fps
frame_timing
cpu_power
@@ -217,6 +216,40 @@ benchmark_percentiles=97,AVG,1,0.1
return {"exists": True, "content": f.read(), "path": config_path}
return {"exists": False, "content": "", "path": config_path}
async def start_mangohud_logging(self) -> dict:
"""RPC: Start MangoHud logging via mangohudctl."""
import subprocess
try:
result = subprocess.run(
["mangohudctl", "set", "log_session", "true"],
capture_output=True, text=True, timeout=5
)
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": str(e)}
async def stop_mangohud_logging(self) -> dict:
"""RPC: Stop MangoHud logging via mangohudctl."""
import subprocess
try:
result = subprocess.run(
["mangohudctl", "set", "log_session", "false"],
capture_output=True, text=True, timeout=5
)
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": str(e)}
async def _find_mangohud_log(self) -> str | None:
"""Find the most recent MangoHud log file in /tmp/.
MangoHud creates log files with the game name and timestamp."""