fix(plugin): add wrapper script to force MangoHud config file
This commit is contained in:
@@ -183,16 +183,13 @@ class Plugin:
|
|||||||
return {"installed": False, "path": "", "version": "", "error": str(e)}
|
return {"installed": False, "path": "", "version": "", "error": str(e)}
|
||||||
|
|
||||||
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 and a wrapper script."""
|
||||||
Returns {success: bool, path: str, error: str?}."""
|
|
||||||
try:
|
try:
|
||||||
home = os.path.expanduser("~")
|
home = os.path.expanduser("~")
|
||||||
config_dir = os.path.join(home, ".config", "MangoHud")
|
config_dir = os.path.join(home, ".config", "MangoHud")
|
||||||
config_path = os.path.join(config_dir, "MangoHud.conf")
|
config_path = os.path.join(config_dir, "MangoHud.conf")
|
||||||
os.makedirs(config_dir, exist_ok=True)
|
os.makedirs(config_dir, exist_ok=True)
|
||||||
|
|
||||||
# MangoHud config that enables logging with the metrics we need.
|
|
||||||
# autostart_log starts logging immediately when MangoHud initializes.
|
|
||||||
config_content = """\
|
config_content = """\
|
||||||
# DeckyVault MangoHud logging config
|
# DeckyVault MangoHud logging config
|
||||||
output_folder=/tmp
|
output_folder=/tmp
|
||||||
@@ -209,7 +206,18 @@ benchmark_percentiles=97,AVG,1,0.1
|
|||||||
with open(config_path, 'w') as f:
|
with open(config_path, 'w') as f:
|
||||||
f.write(config_content)
|
f.write(config_content)
|
||||||
|
|
||||||
return {"success": True, "path": config_path}
|
# Write a wrapper script that forces MangoHud to use our config
|
||||||
|
wrapper_path = os.path.join(home, "deckyvault-mangohud.sh")
|
||||||
|
wrapper_content = """\
|
||||||
|
#!/bin/bash
|
||||||
|
export MANGOHUD_CONFIGFILE="$HOME/.config/MangoHud/MangoHud.conf"
|
||||||
|
exec mangohud "$@"
|
||||||
|
"""
|
||||||
|
with open(wrapper_path, 'w') as f:
|
||||||
|
f.write(wrapper_content)
|
||||||
|
os.chmod(wrapper_path, 0o755)
|
||||||
|
|
||||||
|
return {"success": True, "path": config_path, "wrapper": wrapper_path}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {"success": False, "path": "", "error": str(e)}
|
return {"success": False, "path": "", "error": str(e)}
|
||||||
|
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ export default function MainPanel({
|
|||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
}}>
|
}}>
|
||||||
mangohud %command%
|
~/deckyvault-mangohud.sh %command%
|
||||||
</div>
|
</div>
|
||||||
</PanelSectionRow>
|
</PanelSectionRow>
|
||||||
<PanelSectionRow>
|
<PanelSectionRow>
|
||||||
|
|||||||
Reference in New Issue
Block a user