[PR #2627] [MERGED] launcher: GameMode, MangoHud and dedicated GPU switches on Linux #4485

Closed
opened 2026-11-03 04:17:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2627
Author: @ludovic111
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-linux-toggles


📝 Commits (1)

  • 9bc8e12 launcher: GameMode, MangoHud and dedicated GPU switches on Linux

📊 Changes

6 files changed (+361 additions, -13 deletions)

View changed files

📝 docs/launcher-commands.md (+4 -1)
📝 launcher/README.md (+7 -0)
📝 launcher/src/cli.rs (+62 -2)
📝 launcher/src/launch.rs (+133 -7)
📝 launcher/src/launch/tests.rs (+55 -3)
📝 launcher/src/launch_page.rs (+100 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read.

Launcher features, item 16: Linux switches for GameMode, MangoHud and the dedicated GPU, shown only when the computer has them. Stacked on #2626 (launch options), whose wrap() they build on.

  • launch::Found::here() looks at what this Linux computer has:
    • gamemoderun and mangohud: executable on the PATH.
    • Two graphics cards: two cardN entries under /sys/class/drm.
    • NVIDIA's driver: /proc/driver/nvidia/gpus.
    • Elsewhere it finds nothing.
  • Under "On this computer", the Launch panel shows a switch only for what was found. Each flip is saved to the instance at once.
  • When the game starts:
    • GameMode and MangoHud go before the player's wrapper, outermost first: gamemoderun mangohud <wrapper…> <game>.
    • Dedicated graphics card sets Mesa's DRI_PRIME=1. With NVIDIA's driver loaded it sets __NV_PRIME_RENDER_OFFLOAD=1, __VK_LAYER_NV_optimus=NVIDIA_only and __GLX_VENDOR_LIBRARY_NAME=nvidia instead. The player's own variables come after and win.
  • A switch left on after its tool is gone (or on another system) adds nothing, so a shared or copied instance never breaks Play.
  • The switches are stored as gamemode, mangohud and dedicated_gpu in the instance's launch. A switch that is off isn't written.
  • CLI and MCP: instance launch <instance> --gamemode on|off --mangohud on|off --dedicated-gpu on|off.
    • Turning on a switch whose tool is missing warns and saves anyway.
    • The listing marks "(not on this computer)".
    • It still needs confirm: true over MCP, as in #2626.
  • HORIZON_LAUNCHER_LINUX_TOOLS=gamemode,mangohud,gpu,nvidia makes Found::here() report those, on any system, for tests and screenshots. Off Linux the switches still act on nothing.
  • launcher/README.md: added to the Launch options bullet.

Proof

  • fmt, clippy -D warnings and the launcher tests: clean and passing (180 + 36). The new test covers:
    • the order (gamemoderun mangohud nice game);
    • Mesa vs NVIDIA variables;
    • nothing added when the tools aren't found;
    • the summary;
    • off switches not written.
  • Linux (playhorizon, CPUs 0-3): the launch tests pass, including the real wrapped run. The host has no GameMode, no MangoHud and one card, so Found hides all three there. The launcher binary can't link on that host (no libxcb/libxkbcommon dev files), so there is no live window there.
  • Window (macOS, scratch homes, HORIZON_LAUNCHER_LINUX_TOOLS=gamemode,mangohud,gpu):
    • The three switches showed with the CLI's values.
    • Flipping MangoHud off saved gamemode: true, dedicated_gpu: true and showed "Saved: the next Play through /usr/bin/env HORIZON_WRAPPED=1, with GameMode, on the dedicated GPU, with 1 variable."
Switches MangoHud flipped off

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2627 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-linux-toggles` --- ### 📝 Commits (1) - [`9bc8e12`](https://github.com/horizon-rust/horizon/commit/9bc8e12ad147356b16213045c643c6becf7983fd) launcher: GameMode, MangoHud and dedicated GPU switches on Linux ### 📊 Changes **6 files changed** (+361 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+4 -1) 📝 `launcher/README.md` (+7 -0) 📝 `launcher/src/cli.rs` (+62 -2) 📝 `launcher/src/launch.rs` (+133 -7) 📝 `launcher/src/launch/tests.rs` (+55 -3) 📝 `launcher/src/launch_page.rs` (+100 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read. Launcher features, item 16: Linux switches for GameMode, MangoHud and the dedicated GPU, shown only when the computer has them. Stacked on #2626 (launch options), whose `wrap()` they build on. - `launch::Found::here()` looks at what this Linux computer has: - `gamemoderun` and `mangohud`: executable on the PATH. - Two graphics cards: two `cardN` entries under `/sys/class/drm`. - NVIDIA's driver: `/proc/driver/nvidia/gpus`. - Elsewhere it finds nothing. - Under "On this computer", the Launch panel shows a switch only for what was found. Each flip is saved to the instance at once. - When the game starts: - **GameMode** and **MangoHud** go before the player's wrapper, outermost first: `gamemoderun mangohud <wrapper…> <game>`. - **Dedicated graphics card** sets Mesa's `DRI_PRIME=1`. With NVIDIA's driver loaded it sets `__NV_PRIME_RENDER_OFFLOAD=1`, `__VK_LAYER_NV_optimus=NVIDIA_only` and `__GLX_VENDOR_LIBRARY_NAME=nvidia` instead. The player's own variables come after and win. - A switch left on after its tool is gone (or on another system) adds nothing, so a shared or copied instance never breaks Play. - The switches are stored as `gamemode`, `mangohud` and `dedicated_gpu` in the instance's `launch`. A switch that is off isn't written. - CLI and MCP: `instance launch <instance> --gamemode on|off --mangohud on|off --dedicated-gpu on|off`. - Turning on a switch whose tool is missing warns and saves anyway. - The listing marks "(not on this computer)". - It still needs `confirm: true` over MCP, as in #2626. - `HORIZON_LAUNCHER_LINUX_TOOLS=gamemode,mangohud,gpu,nvidia` makes `Found::here()` report those, on any system, for tests and screenshots. Off Linux the switches still act on nothing. - launcher/README.md: added to the Launch options bullet. ## Proof - fmt, clippy `-D warnings` and the launcher tests: clean and passing (180 + 36). The new test covers: - the order (`gamemoderun mangohud nice game`); - Mesa vs NVIDIA variables; - nothing added when the tools aren't found; - the summary; - off switches not written. - Linux (playhorizon, CPUs 0-3): the launch tests pass, including the real wrapped run. The host has no GameMode, no MangoHud and one card, so `Found` hides all three there. The launcher binary can't link on that host (no `libxcb`/`libxkbcommon` dev files), so there is no live window there. - Window (macOS, scratch homes, `HORIZON_LAUNCHER_LINUX_TOOLS=gamemode,mangohud,gpu`): - The three switches showed with the CLI's values. - Flipping MangoHud off saved `gamemode: true, dedicated_gpu: true` and showed "Saved: the next Play through /usr/bin/env HORIZON_WRAPPED=1, with GameMode, on the dedicated GPU, with 1 variable." | Switches | MangoHud flipped off | |---|---| | ![](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/linux-switches/switches.png) | ![](https://raw.githubusercontent.com/ludovic111/horizon/screenshots/launcher-features/linux-switches/flipped.png) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:31 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4485
No description provided.