feat(linux): start the game through gamescope, with any of its options #227

Merged
HumanBean merged 2 commits from dazemc/LongshotLauncher:feat/gamescope-launch into main 2026-11-21 18:21:35 +00:00
Contributor

Why

Players who run other games under gamescope (HDR output, VRR, resolution scaling, a frame cap, full screen on a TV or Deck) have no way to start Longshot that way from the launcher: Play always starts the game bare. The only workaround is a hand-written wrapper script outside the launcher.

What

On Linux, Settings gains a Gamescope section:

  • a tick, Start the game through gamescope (off by default), and
  • a free-text field for gamescope's options, e.g. -W 3840 -H 2160 -r 164 -f --hdr-enabled --rt --force-grab-cursor.

When the tick is on, Play starts

gamescope <options> -- <game> --user <shared user folder>

with the same environment and working directory the game always gets (GamePlay.Environment). Options are split into words: spaces separate, '…' and "…" group, and a backslash escapes the next character outside quotes. Inside double quotes, it escapes only $, backtick, ", backslash and newline (so --scaler "fit -" and a\ b work). Windows is unaffected, and a settings file shared with a Windows machine is harmless (the setting is ignored there).

Files:

  • Core/LauncherSettings.cs — Gamescope, GamescopeOptions
  • Core/MakeGameCommand.cs — GamePlay.SplitOptions and the wrap in StartInfo
  • App/LauncherService.cs — passes the setting when Play starts a build
  • App/ViewModels/SettingsViewModel.cs, App/Views/SettingsView.axaml — the Settings section
  • tests/launcher_core/GamescopeChecks.cs — the checks

Tested on this PC

Arch Linux, Hyprland (Wayland), RTX 4070 Ti (driver 620.70.06), gamescope 3.16.25, a launcher built from this branch, a game built by the launcher (v3.0.0).

Set the tick on with -W 3840 -H 2160 -r 164 -f --hdr-enabled and started the game through the launcher's own Play path (--play, which goes through LauncherService.PlayFolder). The process it started:

gamescope -W 3840 -H 2160 -r 164 -f --hdr-enabled -- \
  ~/Games/Longshot/stable/v3.0.0/bin/longshot --user ~/.local/share/longshot

The game booted inside it: crash window: off under gamescope (the Steam Deck's Game Mode), gamescope's HDR INFO cv_hdr_enabled: true / uMaxLum: 2500, uRefLum: 203, and Longshot's window at 2560x1440. With the tick off the launcher starts the game itself, as before.

Checks

  • dotnet build App/LongshotLauncher.csproj -c Release — 0 warnings, 0 errors.
  • tests/launcher_core/GamescopeChecks.cs: the splitting cases (quotes, escapes, empty quoted word, blank input) and the exact command, plus gamescope off and Windows (never wrapped). The updated checks are pending.
  • python -I tests/test_launcher_core.py: fails in UnlistedChecks on this branch and on unmodified main, same message (got: dev stable (2) v3.0.0-rc.4 v3.0.3); verified by stashing the change. Not caused here.
  • Tooling's tests/test_release.py (LAUNCHER=$PWD): 3 failures (test_the_bump, test_the_next_stable, test_check_tag_against_the_published_releases), the same list on main and on this branch.

Not included

  • Translation entries for the new strings (they fall back to English, like other untranslated texts).
## Why Players who run other games under gamescope (HDR output, VRR, resolution scaling, a frame cap, full screen on a TV or Deck) have no way to start Longshot that way from the launcher: Play always starts the game bare. The only workaround is a hand-written wrapper script outside the launcher. ## What On Linux, Settings gains a **Gamescope** section: - a tick, **Start the game through gamescope** (off by default), and - a free-text field for gamescope's options, e.g. `-W 3840 -H 2160 -r 164 -f --hdr-enabled --rt --force-grab-cursor`. When the tick is on, Play starts ``` gamescope <options> -- <game> --user <shared user folder> ``` with the same environment and working directory the game always gets (`GamePlay.Environment`). Options are split into words: spaces separate, `'…'` and `"…"` group, and a backslash escapes the next character outside quotes. Inside double quotes, it escapes only `$`, backtick, `"`, backslash and newline (so `--scaler "fit -"` and `a\ b` work). Windows is unaffected, and a settings file shared with a Windows machine is harmless (the setting is ignored there). Files: - `Core/LauncherSettings.cs` — `Gamescope`, `GamescopeOptions` - `Core/MakeGameCommand.cs` — `GamePlay.SplitOptions` and the wrap in `StartInfo` - `App/LauncherService.cs` — passes the setting when Play starts a build - `App/ViewModels/SettingsViewModel.cs`, `App/Views/SettingsView.axaml` — the Settings section - `tests/launcher_core/GamescopeChecks.cs` — the checks ## Tested on this PC Arch Linux, Hyprland (Wayland), RTX 4070 Ti (driver 620.70.06), gamescope 3.16.25, a launcher built from this branch, a game built by the launcher (v3.0.0). Set the tick on with `-W 3840 -H 2160 -r 164 -f --hdr-enabled` and started the game through the launcher's own Play path (`--play`, which goes through `LauncherService.PlayFolder`). The process it started: ``` gamescope -W 3840 -H 2160 -r 164 -f --hdr-enabled -- \ ~/Games/Longshot/stable/v3.0.0/bin/longshot --user ~/.local/share/longshot ``` The game booted inside it: `crash window: off under gamescope (the Steam Deck's Game Mode)`, gamescope's `HDR INFO cv_hdr_enabled: true` / `uMaxLum: 2500, uRefLum: 203`, and Longshot's window at 2560x1440. With the tick off the launcher starts the game itself, as before. ## Checks - `dotnet build App/LongshotLauncher.csproj -c Release` — 0 warnings, 0 errors. - `tests/launcher_core/GamescopeChecks.cs`: the splitting cases (quotes, escapes, empty quoted word, blank input) and the exact command, plus gamescope off and Windows (never wrapped). The updated checks are pending. - `python -I tests/test_launcher_core.py`: fails in `UnlistedChecks` on this branch **and on unmodified `main`**, same message (`got: dev stable (2) v3.0.0-rc.4 v3.0.3`); verified by stashing the change. Not caused here. - Tooling's `tests/test_release.py` (`LAUNCHER=$PWD`): 3 failures (`test_the_bump`, `test_the_next_stable`, `test_check_tag_against_the_published_releases`), the same list on `main` and on this branch. ## Not included - Translation entries for the new strings (they fall back to English, like other untranslated texts).
feat(linux): start the game through gamescope, with any of its options
Some checks failed
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Compile and test (pull_request) Has been cancelled
28c039f3b7
Settings has a Gamescope section on Linux: a tick that starts the game
through gamescope and a text field for its options (-W, -H, -r, -f,
--hdr-enabled, --rt, ...), split as a shell would and put before -- and
the game's own arguments. Off by default, so nothing changes for anyone
who doesn't use it.
Author
Contributor

Tested end to end on this PC: with the tick on, Play started gamescope -- --user ; the game booted under gamescope with its Game Mode path and HDR. Checks and the two pre-existing suite failures (identical on main) are in the description.

Tested end to end on this PC: with the tick on, Play started gamescope <options> -- <game> --user <folder>; the game booted under gamescope with its Game Mode path and HDR. Checks and the two pre-existing suite failures (identical on main) are in the description.
dazemc changed title from WIP: feat(linux): start the game through gamescope, with any of its options to feat(linux): start the game through gamescope, with any of its options 2026-11-21 12:51:35 +00:00
Owner
@review
HumanBean added this to the WIP project 2026-11-21 15:55:08 +00:00
BeanBot left a comment

Recommendation: Request changes. The new options field can change valid arguments before gamescope receives them, so some configurations do not work as advertised. The reported Linux run demonstrates the basic launch path, but the input handling needs correction.

Adds an off-by-default Linux setting to start Longshot through gamescope with player-supplied options. It enables the demonstrated HDR launch, at the cost of maintaining an option parser and exposing its input errors to players.

@fix will do (3)

  1. L1 Core/MakeGameCommand.cs:269: Inside double quotes, a shell preserves a backslash before ordinary characters, but this removes it. (more on the line)
  2. L2 App/ViewModels/SettingsViewModel.cs:276: Trimming the stored text changes valid shell-style input: a final escaped space, such as a\ , becomes a trailing backslash and produces a different argument. (more on the line)
  3. L3 (minor): The PR changes the Settings screen but includes no screenshot. Add one of the new Linux section, as required by the repository's pull request rules.

Checks: Still running: CI / Conventional Commit title (pull_request), CI / Compile and test (pull_request).

More: does it help, other systems, switches, what was read

Does it help: Yes for the demonstrated configuration: the author reports that a launcher build started the game under gamescope 3.16.25 with HDR on Arch Linux and an RTX 4070 Ti. Other option parsing cases remain incorrect; this is not a performance claim.

Other systems: The wrapper applies only on Linux. Windows ignores the setting, and the existing game environment and working directory are retained. The reported run covers Wayland and NVIDIA; Steam Deck, other compositors and GPU vendors were not reported tested.

Switches: Gamescope is added, default off, which preserves existing launches. GamescopeOptions is added, default empty, leaving gamescope's defaults in effect. Both are launcher settings, not environment switches.

Reviewed: 28c039f3b7 against e2220601db: Read the repository rules, commit, diff, changed settings, view, launch command and gamescope checks, and surrounding Play callers and error handling. The large LauncherService.cs and tests/launcher_core/Program.cs were skimmed outside the changed paths; no review checklist or pull request template was found. No recorded runs or generated files were changed.; nothing run (a code review).

Checked and fine:

  • The default launch remains unwrapped, and Windows ignores the gamescope setting.
  • Arguments use ProcessStartInfo.ArgumentList rather than a shell, preserving spaces in the game and user-folder paths.
  • The new checks exercise the command order and the off and Windows paths.
  • The reported suite failures also occur on the base according to the author.

Testing: Read-only review; no code or tests were run. CI compile-and-test and title checks were still running in the supplied status.

Overlaps and merge order: None found in the supplied context.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The new options field can change valid arguments before gamescope receives them, so some configurations do not work as advertised. The reported Linux run demonstrates the basic launch path, but the input handling needs correction. Adds an off-by-default Linux setting to start Longshot through gamescope with player-supplied options. It enables the demonstrated HDR launch, at the cost of maintaining an option parser and exposing its input errors to players. **`@fix` will do (3)** 1. **L1** `Core/MakeGameCommand.cs:269`: Inside double quotes, a shell preserves a backslash before ordinary characters, but this removes it. (more on the line) 2. **L2** `App/ViewModels/SettingsViewModel.cs:276`: Trimming the stored text changes valid shell-style input: a final escaped space, such as a\ , becomes a trailing backslash and produces a different argument. (more on the line) 3. **L3** (minor): The PR changes the Settings screen but includes no screenshot. Add one of the new Linux section, as required by the repository's pull request rules. **Checks:** Still running: `CI / Conventional Commit title (pull_request)`, `CI / Compile and test (pull_request)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the demonstrated configuration: the author reports that a launcher build started the game under gamescope 3.16.25 with HDR on Arch Linux and an RTX 4070 Ti. Other option parsing cases remain incorrect; this is not a performance claim. **Other systems:** The wrapper applies only on Linux. Windows ignores the setting, and the existing game environment and working directory are retained. The reported run covers Wayland and NVIDIA; Steam Deck, other compositors and GPU vendors were not reported tested. **Switches:** Gamescope is added, default off, which preserves existing launches. GamescopeOptions is added, default empty, leaving gamescope's defaults in effect. Both are launcher settings, not environment switches. **Reviewed:** 28c039f3b748 against e2220601db28: Read the repository rules, commit, diff, changed settings, view, launch command and gamescope checks, and surrounding Play callers and error handling. The large LauncherService.cs and tests/launcher_core/Program.cs were skimmed outside the changed paths; no review checklist or pull request template was found. No recorded runs or generated files were changed.; nothing run (a code review). **Checked and fine:** - The default launch remains unwrapped, and Windows ignores the gamescope setting. - Arguments use ProcessStartInfo.ArgumentList rather than a shell, preserving spaces in the game and user-folder paths. - The new checks exercise the command order and the off and Windows paths. - The reported suite failures also occur on the base according to the author. **Testing:** Read-only review; no code or tests were run. CI compile-and-test and title checks were still running in the supplied status. **Overlaps and merge order:** None found in the supplied context. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -256,0 +273,4 @@
get => s.GamescopeOptions ?? "";
set
{
s.GamescopeOptions = string.IsNullOrWhiteSpace(value) ? null : value.Trim();
Member

L2: Trimming the stored text changes valid shell-style input: a final escaped space, such as a\ , becomes a trailing backslash and produces a different argument. Store the text as entered and let the parser handle whitespace; add a check through the settings path.

**L2**: Trimming the stored text changes valid shell-style input: a final escaped space, such as a\ , becomes a trailing backslash and produces a different argument. Store the text as entered and let the parser handle whitespace; add a check through the settings path.
@ -252,0 +266,4 @@
{
if (c == quoted) quoted = '\0';
else if (c == '\\' && quoted == '"' && i + 1 < options.Length) word.Append(options[++i]);
else word.Append(c);
Member

L1: Inside double quotes, a shell preserves a backslash before ordinary characters, but this removes it. For example, an option value typed as "a\b" reaches gamescope as ab instead of a\b. Preserve the backslash except before characters for which double-quoted shell escaping applies, and cover that case in the checks.

**L1**: Inside double quotes, a shell preserves a backslash before ordinary characters, but this removes it. For example, an option value typed as "a\b" reaches gamescope as ab instead of a\b. Preserve the backslash except before characters for which double-quoted shell escaping applies, and cover that case in the checks.
Owner
@fix
BeanBot force-pushed feat/gamescope-launch from 28c039f3b7
Some checks failed
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Compile and test (pull_request) Has been cancelled
to 65418c8e8b
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 21s
2026-11-21 17:04:01 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The gamescope feature has a reported successful Linux launch, but the updated settings and option parsing checks have not yet run. The required screenshot of the new settings section is also still missing. Nothing blocking is left. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 65418c8e8b. I rebased it onto main (5f16dcd74e). I edited its description to match the change.

Changed

  • Double-quoted escapes in Core/MakeGameCommand.cs:268: Preserved backslashes before ordinary characters and added checks for double-quoted shell escapes in tests/launcher_core/GamescopeChecks.cs:19.
  • Gamescope settings round trip: Added an app-level check in tests/launcher_app/Program.cs:20 that assigns an escaped final space through the real settings setter, reloads the saved settings, and verifies the launch argument. The strict test runner invokes it. Tests were not run, as requested.

Nothing was built or run: the checks run again on the new head.

Adds an optional Linux gamescope wrapper with configurable arguments; it is off by default and ignored on Windows. It gives players access to gamescope features at the cost of maintaining an argument parser and an additional settings section.

@fix will do (1)

  1. L3 (minor): The PR changes the Settings screen but includes no screenshot. Add one of the new Linux section, as required by the repository's pull request rules.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (2; not asked for, not blocking)
  • The base diff also includes Steam shortcut, artwork and window title changes that the pull request description does not mention.
  • The updated automated checks are pending on this head.
More: does it help, other systems, switches, what was read

Does it help: Yes for the feature: the author reports that Longshot booted through gamescope with HDR on Arch Linux. The updated automated checks are pending; this is not a performance change.

Other systems: Windows ignores the gamescope setting. Linux launches retain the game environment and working directory; the reported end-to-end run covers one NVIDIA Wayland setup, not other drivers or desktop environments.

Switches: Adds Gamescope, off by default, and GamescopeOptions, empty by default. The opt-in default preserves existing launches.

Reviewed: 65418c8e8b against 5f16dcd74e: Read the repository rules, the posted description and reviews, the gamescope parser and launch path, settings setter, new app and core checks, test runner changes, and project build settings. The full base-to-head diff is much larger than the listed feature and was only skimmed; other changed files and assets were not read in full.; nothing run (a code review).

Checked and fine:

  • The settings setter preserves the typed options, including an escaped trailing space.
  • The double-quoted parser preserves backslashes before ordinary characters and handles the listed shell special characters.
  • The launch command places gamescope options before the separator and leaves Windows unwrapped.

Testing: No commands from the project were run. The author reports a successful Linux launch and earlier build; CI and the updated checks are pending. The description reports existing suite failures on both main and the branch.

Overlaps and merge order: none found


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The gamescope feature has a reported successful Linux launch, but the updated settings and option parsing checks have not yet run. The required screenshot of the new settings section is also still missing. Nothing blocking is left. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 65418c8e8b48. I rebased it onto `main` (5f16dcd74efe). I edited its description to match the change. **Changed** - **Double-quoted escapes in Core/MakeGameCommand.cs:268**: Preserved backslashes before ordinary characters and added checks for double-quoted shell escapes in tests/launcher_core/GamescopeChecks.cs:19. - **Gamescope settings round trip**: Added an app-level check in tests/launcher_app/Program.cs:20 that assigns an escaped final space through the real settings setter, reloads the saved settings, and verifies the launch argument. The strict test runner invokes it. Tests were not run, as requested. Nothing was built or run: the checks run again on the new head. Adds an optional Linux gamescope wrapper with configurable arguments; it is off by default and ignored on Windows. It gives players access to gamescope features at the cost of maintaining an argument parser and an additional settings section. **`@fix` will do (1)** 1. **L3** (minor): The PR changes the Settings screen but includes no screenshot. Add one of the new Linux section, as required by the repository's pull request rules. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (2; not asked for, not blocking)</summary> - The base diff also includes Steam shortcut, artwork and window title changes that the pull request description does not mention. - The updated automated checks are pending on this head. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the feature: the author reports that Longshot booted through gamescope with HDR on Arch Linux. The updated automated checks are pending; this is not a performance change. **Other systems:** Windows ignores the gamescope setting. Linux launches retain the game environment and working directory; the reported end-to-end run covers one NVIDIA Wayland setup, not other drivers or desktop environments. **Switches:** Adds Gamescope, off by default, and GamescopeOptions, empty by default. The opt-in default preserves existing launches. **Reviewed:** 65418c8e8b48 against 5f16dcd74efe: Read the repository rules, the posted description and reviews, the gamescope parser and launch path, settings setter, new app and core checks, test runner changes, and project build settings. The full base-to-head diff is much larger than the listed feature and was only skimmed; other changed files and assets were not read in full.; nothing run (a code review). **Checked and fine:** - The settings setter preserves the typed options, including an escaped trailing space. - The double-quoted parser preserves backslashes before ordinary characters and handles the listed shell special characters. - The launch command places gamescope options before the separator and leaves Windows unwrapped. **Testing:** No commands from the project were run. The author reports a successful Linux launch and earlier build; CI and the updated checks are pending. The description reports existing suite failures on both main and the branch. **Overlaps and merge order:** none found </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch feat/gamescope-launch 2026-11-21 18:21:38 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/LongshotLauncher!227
No description provided.